2 Copyright (C) 2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "AgenorUserManager.h"
25 static void usage(NSArray *args) {
26 fprintf(stderr, "usage: %s <uid1> <uid2> <uid3>\n",
27 [[args objectAtIndex:0] cString]);
30 static void handleUID(NSString *uid, AgenorUserManager *userManager) {
34 shares = [userManager getSharedMailboxAccountStringsForUID:uid];
36 printf("%s:", [uid cString]);
38 if ((count = [shares count]) == 0) {
39 printf(" <no shares>\n");
44 for (i = 0; i < count; i++)
45 printf(" %s\n", [[shares objectAtIndex:i] cString]);
48 static void doIt(NSArray *args) {
49 AgenorUserManager *userManager;
53 if ([args count] < 2) {
58 userManager = [AgenorUserManager sharedUserManager];
60 e = [args objectEnumerator];
61 [e nextObject]; /* consume the command name */
63 while ((uid = [e nextObject]) != nil)
64 handleUID(uid, userManager);
67 int main(int argc, char **argv, char **env) {
68 NSAutoreleasePool *pool;
70 pool = [[NSAutoreleasePool alloc] init];
71 #if LIB_FOUNDATION_LIBRARY
72 [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
75 doIt([[NSProcessInfo processInfo] argumentsWithoutDefaults]);