ObjFW  Diff

Differences From Artifact [77883af432]:

To Artifact [93776e4552]:


164
165
166
167
168
169
170
171
172





173
174
175
176







177
178
179
180







181
182
183
184







185
186
187
188







189
190


191
192
193
194
195
196
197
164
165
166
167
168
169
170


171
172
173
174
175




176
177
178
179
180
181
182




183
184
185
186
187
188
189




190
191
192
193
194
195
196




197
198
199
200
201
202
203


204
205
206
207
208
209
210
211
212







-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+







		 * iOS does not provide environ and Apple does not allow using
		 * _NSGetEnviron on iOS. Therefore, we just get a few common
		 * variables from the environment which applications might
		 * expect.
		 */
		pool = objc_autoreleasePoolPush();

		if ((env = getenv("HOME")) != NULL)
			[environment
		if ((env = getenv("HOME")) != NULL) {
			OFString *home = [[[OFString alloc]
			    initWithUTF8StringNoCopy: env
					freeWhenDone: NO] autorelease];
			[environment setObject: home
			    setObject: [OFString stringWithUTF8String: env]
			       forKey: @"HOME"];
		if ((env = getenv("PATH")) != NULL)
			[environment
					forKey: @"HOME"];
		}
		if ((env = getenv("PATH")) != NULL) {
			OFString *path = [[[OFString alloc]
			    initWithUTF8StringNoCopy: env
					freeWhenDone: NO] autorelease];
			[environment setObject: path
			    setObject: [OFString stringWithUTF8String: env]
			       forKey: @"PATH"];
		if ((env = getenv("SHELL")) != NULL)
			[environment
					forKey: @"PATH"];
		}
		if ((env = getenv("SHELL")) != NULL) {
			OFString *shell = [[[OFString alloc]
			    initWithUTF8StringNoCopy: env
					freeWhenDone: NO] autorelease];
			[environment setObject: shell
			    setObject: [OFString stringWithUTF8String: env]
			       forKey: @"SHELL"];
		if ((env = getenv("TMPDIR")) != NULL)
			[environment
					forKey: @"SHELL"];
		}
		if ((env = getenv("TMPDIR")) != NULL) {
			OFString *tmpdir = [[[OFString alloc]
			    initWithUTF8StringNoCopy: env
					freeWhenDone: NO] autorelease];
			[environment setObject: tmpdir
			    setObject: [OFString stringWithUTF8String: env]
			       forKey: @"TMPDIR"];
		if ((env = getenv("USER")) != NULL)
			[environment
					forKey: @"TMPDIR"];
		}
		if ((env = getenv("USER")) != NULL) {
			OFString *user = [[[OFString alloc]
			    initWithUTF8StringNoCopy: env
					freeWhenDone: NO] autorelease];
			[environment setObject: user
			    setObject: [OFString stringWithUTF8String: env]
			       forKey: @"USER"];
					forKey: @"USER"];
		}

		objc_autoreleasePoolPop(pool);
#endif

		[environment makeImmutable];
	} @catch (id e) {
		[self release];