2 Copyright (C) 2000-2004 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 <NGExtensions/NGResourceLocator.h>
25 static void usage(void) {
27 "usage: sope-rsrclookup <gnustep-subdir> <fhs-subdir> <rsrc>\n");
30 static void testit(NSArray *args) {
31 NGResourceLocator *loc;
32 NSString *gs, *fhs, *rsrc;
34 if ([args count] < 3) {
39 gs = [args objectAtIndex:1];
40 fhs = [args objectAtIndex:2];
41 loc = [NGResourceLocator resourceLocatorForGNUstepPath:gs fhsPath:fhs];
42 rsrc = [args count] < 4 ? nil : [args objectAtIndex:3];
47 if ((a = [loc gsRootPathes]) != nil)
48 NSLog(@"GNUstep Lookup Pathes: %@", a);
50 if ((a = [loc fhsRootPathes]) != nil)
51 NSLog(@"FHS Lookup Pathes: %@", a);
53 if ((a = [loc searchPathes]) != nil)
54 NSLog(@"Pathes: %@", a);
59 p = [loc lookupFileWithName:rsrc];
61 fprintf(stderr, "did not find resource: %s\n", [rsrc cString]);
64 printf("%s\n", [p cString]);
68 int main(int argc, char **argv, char **env) {
69 NSAutoreleasePool *pool;
71 pool = [[NSAutoreleasePool alloc] init];
72 #if LIB_FOUNDATION_LIBRARY
73 [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
76 testit([[NSProcessInfo processInfo] argumentsWithoutDefaults]);