PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/Tools/squid-users.m

http://eeframework.googlecode.com/
Objective C | 54 lines | 42 code | 10 blank | 2 comment | 5 complexity | 0f73dc9703f1a86cf574a95bef22bca7 MD5 | raw file
 1// -*- objc -*-
 2// -*- coding: koi8-r -*-
 3
 4#import <Foundation/Foundation.h>
 5#import "SquidAggregator/SquidAggregator.h"
 6#import <GNUstepBase/GSLocale.h>
 7#include <stdio.h>
 8#include <time.h>
 9
10void usage()
11{
12      printf("SQUID Users Populating utility v.0.1.0\n");
13      printf("The squid log analyzing tool.\n");
14      printf("\n  --help\n\tthis help.\n");
15      printf("\n  --populate\n\tthe file with the orgs and users table.\n");
16      printf("\n  --dump\n\tdumps the user list to the standard output.\n");
17      printf("\n");
18      exit(EXIT_SUCCESS);  
19}
20
21int
22main(int argc, char** argv, char** env)
23{
24  CREATE_AUTORELEASE_POOL(pool);
25  SquidAggregator *sa = [SquidAggregator new]; //the current month
26  NSProcessInfo	 *pInfo = [NSProcessInfo processInfo];
27  BOOL help = YES;
28
29
30  if ([[pInfo arguments] containsObject: @"--populate"] == YES)
31    {
32      NSString *file = [[pInfo arguments] 
33			  objectAtIndex:[[pInfo arguments] 
34					  indexOfObject:@"--populate"] + 1];
35
36      [sa populateOrgsAndPersonsWithPath:file];
37    }
38
39  if ([[pInfo arguments] containsObject: @"--dump"] == YES)
40    {
41      [sa dumpUsers];
42      help = NO;
43    }
44
45  RELEASE(sa);
46  RELEASE(pool);
47
48  if(help)
49    {
50      usage();
51    }
52
53  return 0;
54}