1995-08-16 16:19:31 +00:00
|
|
|
#include <Foundation/NSProcessInfo.h>
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSDictionary.h>
|
|
|
|
#include <Foundation/NSDate.h>
|
1998-10-03 05:11:05 +00:00
|
|
|
#include <Foundation/NSAutoreleasePool.h>
|
1995-08-16 15:47:12 +00:00
|
|
|
|
2005-02-22 11:22:44 +00:00
|
|
|
int main(int argc, char *argv[])
|
1995-08-16 15:47:12 +00:00
|
|
|
{
|
1998-10-03 05:11:05 +00:00
|
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
1995-08-16 15:47:12 +00:00
|
|
|
NSProcessInfo *pi = [NSProcessInfo processInfo];
|
|
|
|
NSString* aString;
|
|
|
|
NSString* aKey;
|
|
|
|
NSEnumerator* enumerator;
|
|
|
|
|
2002-04-08 15:31:59 +00:00
|
|
|
printf("Host name: %s\n",[[pi hostName] cString]);
|
|
|
|
printf("Operating system: %d\n",[pi operatingSystem]);
|
|
|
|
printf("Operating system name: %s\n",[[pi operatingSystemName] cString]);
|
1997-01-09 16:24:07 +00:00
|
|
|
printf("Process Name: %s\n",[[pi processName] cString]);
|
|
|
|
printf("Globally Unique String: %s\n",[[pi globallyUniqueString] cString]);
|
1995-08-16 15:47:12 +00:00
|
|
|
|
1997-01-09 16:24:07 +00:00
|
|
|
printf("\nProcess arguments\n");
|
|
|
|
printf("%d argument(s)\n", [[pi arguments] count]);
|
1995-08-16 15:47:12 +00:00
|
|
|
enumerator = [[pi arguments] objectEnumerator];
|
1995-08-16 16:19:31 +00:00
|
|
|
while ((aString = [enumerator nextObject]))
|
|
|
|
printf("-->%s\n",[aString cString]);
|
2005-02-22 11:22:44 +00:00
|
|
|
|
1997-01-09 16:24:07 +00:00
|
|
|
printf("\nProcess environment\n");
|
|
|
|
printf("%d environment variables(s)\n", [[pi environment] count]);
|
1995-08-16 15:47:12 +00:00
|
|
|
enumerator = [[pi environment] keyEnumerator];
|
1995-08-16 16:19:31 +00:00
|
|
|
while ((aKey = [enumerator nextObject]))
|
2005-02-22 11:22:44 +00:00
|
|
|
printf("++>%s=%s\n",[aKey cString],[[[pi environment]
|
1995-08-16 15:47:12 +00:00
|
|
|
objectForKey:aKey] cString]);
|
1995-08-16 16:19:31 +00:00
|
|
|
|
1998-10-03 05:11:05 +00:00
|
|
|
[arp release];
|
1995-08-16 16:19:31 +00:00
|
|
|
exit(0);
|
1995-08-16 15:47:12 +00:00
|
|
|
}
|