/Tools/squid-orgs.m
http://eeframework.googlecode.com/ · Objective C · 69 lines · 55 code · 12 blank · 2 comment · 9 complexity · 99037d7ea9e4883974c3b0a9eb65a768 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 Organizations Populating utility v.0.1.0\n");
- printf("This tool is intended to store the links between organizations and users.\n");
- printf("\n --help\n\tthis help.\n");
- printf("\n --populate <file>\n\tthe file with the orgs and users table.\n");
- printf("\n --restore\n\trestore the orgs and users table.\n");
- printf("\n --store\n\tstore the orgs and users table.\n");
- printf("\n --dump\n\tdumps the organization 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: @"--restore"] == YES)
- {
- [sa restoreOrgsAndPersons];
- help = NO;
- }
- if ([[pInfo arguments] containsObject: @"--store"] == YES)
- {
- [sa storeOrgsAndPersons];
- help = NO;
- }
- if ([[pInfo arguments] containsObject: @"--dump"] == YES)
- {
- [sa dumpOrgs];
- [sa dumpPersons];
- help = NO;
- }
- RELEASE(sa);
- RELEASE(pool);
- if(help)
- {
- usage();
- }
- return 0;
- }