87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
+ (void)terminateWithStatus: (int)status
{
exit(status);
}
- init
{
OFAutoreleasePool *pool;
char **env;
self = [super init];
environment = [[OFMutableDictionary alloc] init];
atexit(atexit_handler);
#ifdef __MACH__
env = *_NSGetEnviron();
#else
env = environ;
#endif
pool = [[OFAutoreleasePool alloc] init];
for (; *env != NULL; env++) {
OFString *key;
OFString *value;
char *sep;
if ((sep = strchr(*env, '=')) == NULL) {
fprintf(stderr, "Warning: Invalid environment "
"variable: %s\n", *env);
continue;
}
key = [OFString stringWithCString: *env
length: sep - *env];
value = [OFString stringWithCString: sep + 1];
[environment setObject: value
forKey: key];
[pool releaseObjects];
}
[pool release];
return self;
}
- (void)setArgumentCount: (int*)argc_
andArgumentValues: (char***)argv_
{
|
>
>
>
|
|
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
+ (void)terminateWithStatus: (int)status
{
exit(status);
}
- init
{
self = [super init];
@try {
OFAutoreleasePool *pool;
char **env;
environment = [[OFMutableDictionary alloc] init];
atexit(atexit_handler);
#ifdef __MACH__
env = *_NSGetEnviron();
#else
env = environ;
#endif
pool = [[OFAutoreleasePool alloc] init];
for (; *env != NULL; env++) {
OFString *key;
OFString *value;
char *sep;
if ((sep = strchr(*env, '=')) == NULL) {
fprintf(stderr, "Warning: Invalid environment "
"variable: %s\n", *env);
continue;
}
key = [OFString stringWithCString: *env
length: sep - *env];
value = [OFString stringWithCString: sep + 1];
[environment setObject: value
forKey: key];
[pool releaseObjects];
}
[pool release];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)setArgumentCount: (int*)argc_
andArgumentValues: (char***)argv_
{
|