]> err.no Git - scalable-opengroupware.org/blob - db/tests/znek/lmail.m
5fb42715ed280538d66da2e14e9a5ca4dd5697ec
[scalable-opengroupware.org] / db / tests / znek / lmail.m
1 /*
2   @DISCLAIMER@
3 */
4 // $Id$
5
6 #import <Foundation/Foundation.h>
7
8 #define DEBUG 0
9
10 #define ALL_RECORDS @"/tmp/all.nsarray"
11
12 #ifndef MAX
13 #define MAX(a,b) (((a)>(b))?(a):(b))
14 #endif
15
16
17 int main(int argc, char **argv, char **env) {
18     NSAutoreleasePool *pool;
19     NSArray *records;
20     unsigned int i, count, maxLength;
21     NSString *longestMailto;
22
23     pool = [[NSAutoreleasePool alloc] init];
24 #if LIB_FOUNDATION_LIBRARY
25     [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
26 #endif
27
28     records = [NSArray arrayWithContentsOfFile:ALL_RECORDS];
29     count = [records count];
30     maxLength = 0;
31
32     for(i = 0; i < count; i++) {
33         NSString *mailto;
34         unsigned length;
35
36         mailto = [[records objectAtIndex:i] objectForKey:@"mailto"];
37         length = [mailto length];
38         maxLength = MAX(maxLength, length);
39         if(length == maxLength)
40             longestMailto = mailto;
41     }
42     printf("\nTotal: %d\nMaxlength: %d\nlongest: %s\n", count, maxLength, [longestMailto cString]);
43     [pool release];
44     exit(0);
45     return 0;
46 }