︙ | | |
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
-
+
|
@try {
_environment = [[OFMutableDictionary alloc] init];
atexit(atexitHandler);
#if defined(OF_WINDOWS)
if ([OFSystemInfo isWindowsNT]) {
of_char16_t *env, *env0;
OFChar16 *env, *env0;
env = env0 = GetEnvironmentStringsW();
while (*env != 0) {
void *pool = objc_autoreleasePoolPush();
OFString *tmp, *key, *value;
size_t length, pos;
|
︙ | | |
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
-
+
|
*/
if ([tmp hasPrefix: @"="]) {
objc_autoreleasePoolPop(pool);
continue;
}
pos = [tmp rangeOfString: @"="].location;
if (pos == OF_NOT_FOUND) {
if (pos == OFNotFound) {
fprintf(stderr,
"Warning: Invalid environment "
"variable: %s\n", tmp.UTF8String);
continue;
}
key = [tmp substringToIndex: pos];
|
︙ | | |
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
-
+
-
+
|
*/
if ([tmp hasPrefix: @"="]) {
objc_autoreleasePoolPop(pool);
continue;
}
pos = [tmp rangeOfString: @"="].location;
if (pos == OF_NOT_FOUND) {
if (pos == OFNotFound) {
fprintf(stderr,
"Warning: Invalid environment "
"variable: %s\n", tmp.UTF8String);
continue;
}
key = [tmp substringToIndex: pos];
value = [tmp substringFromIndex: pos + 1];
[_environment setObject: value forKey: key];
objc_autoreleasePoolPop(pool);
}
FreeEnvironmentStringsA(env0);
}
#elif defined(OF_AMIGAOS)
void *pool = objc_autoreleasePoolPush();
OFFileManager *fileManager = [OFFileManager defaultManager];
OFArray *envContents =
[fileManager contentsOfDirectoryAtPath: @"ENV:"];
const of_string_encoding_t encoding = [OFLocale encoding];
OFStringEncoding encoding = [OFLocale encoding];
struct Process *proc;
struct LocalVar *firstLocalVar;
for (OFString *name in envContents) {
void *pool2 = objc_autoreleasePoolPush();
OFString *path, *value;
OFFile *file;
|
︙ | | |
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
-
-
+
|
# ifndef OF_MACOS
char **env = environ;
# else
char **env = *_NSGetEnviron();
# endif
if (env != NULL) {
const of_string_encoding_t encoding =
[OFLocale encoding];
OFStringEncoding encoding = [OFLocale encoding];
for (; *env != NULL; env++) {
void *pool = objc_autoreleasePoolPush();
OFString *key, *value;
char *sep;
if ((sep = strchr(*env, '=')) == NULL) {
|
︙ | | |
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
|
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
-
+
|
[super dealloc];
}
- (void)of_setArgumentCount: (int *)argc andArgumentValues: (char ***)argv
{
void *pool = objc_autoreleasePoolPush();
OFMutableArray *arguments;
of_string_encoding_t encoding;
OFStringEncoding encoding;
_argc = argc;
_argv = argv;
encoding = [OFLocale encoding];
#ifndef OF_NINTENDO_DS
|
︙ | | |
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
|
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
|
-
+
|
}
#ifdef OF_HAVE_SANDBOX
- (void)of_activateSandbox: (OFSandbox *)sandbox
{
# ifdef OF_HAVE_PLEDGE
void *pool = objc_autoreleasePoolPush();
of_string_encoding_t encoding = [OFLocale encoding];
OFStringEncoding encoding = [OFLocale encoding];
OFArray OF_GENERIC(of_sandbox_unveil_path_t) *unveiledPaths;
size_t unveiledPathsCount;
const char *promises;
if (_activeSandbox != nil && sandbox != _activeSandbox)
@throw [OFInvalidArgumentException exception];
|
︙ | | |