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