/Tools/squid-users.m
http://eeframework.googlecode.com/ · Objective C · 54 lines · 42 code · 10 blank · 2 comment · 5 complexity · 0f73dc9703f1a86cf574a95bef22bca7 MD5 · raw file
- // -*- objc -*-
- // -*- coding: koi8-r -*-
- #import <Foundation/Foundation.h>
- #import "SquidAggregator/SquidAggregator.h"
- #import <GNUstepBase/GSLocale.h>
- #include <stdio.h>
- #include <time.h>
- void usage()
- {
- printf("SQUID Users Populating utility v.0.1.0\n");
- printf("The squid log analyzing tool.\n");
- printf("\n --help\n\tthis help.\n");
- printf("\n --populate\n\tthe file with the orgs and users table.\n");
- printf("\n --dump\n\tdumps the user list to the standard output.\n");
- printf("\n");
- exit(EXIT_SUCCESS);
- }
- int
- main(int argc, char** argv, char** env)
- {
- CREATE_AUTORELEASE_POOL(pool);
- SquidAggregator *sa = [SquidAggregator new]; //the current month
- NSProcessInfo *pInfo = [NSProcessInfo processInfo];
- BOOL help = YES;
- if ([[pInfo arguments] containsObject: @"--populate"] == YES)
- {
- NSString *file = [[pInfo arguments]
- objectAtIndex:[[pInfo arguments]
- indexOfObject:@"--populate"] + 1];
- [sa populateOrgsAndPersonsWithPath:file];
- }
- if ([[pInfo arguments] containsObject: @"--dump"] == YES)
- {
- [sa dumpUsers];
- help = NO;
- }
- RELEASE(sa);
- RELEASE(pool);
- if(help)
- {
- usage();
- }
- return 0;
- }