comparison nt/cmdproxy.c @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents f6aff87320dd
children 695cf19ef79e d7ddb3e565de
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
228 int n_exts = sizeof (exts) / sizeof (char *); 228 int n_exts = sizeof (exts) / sizeof (char *);
229 char *dummy; 229 char *dummy;
230 int i, rc; 230 int i, rc;
231 231
232 /* Search the directory for the program. */ 232 /* Search the directory for the program. */
233 for (i = 0; i < n_exts; i++) 233 for (i = 0; i < n_exts; i++)
234 { 234 {
235 rc = SearchPath (dir, exec, exts[i], bufsize, buffer, &dummy); 235 rc = SearchPath (dir, exec, exts[i], bufsize, buffer, &dummy);
236 if (rc > 0) 236 if (rc > 0)
237 return rc; 237 return rc;
238 } 238 }
239 239
240 return 0; 240 return 0;
241 } 241 }
242 242
243 /* Return the absolute name of executable file PROG, including 243 /* Return the absolute name of executable file PROG, including
244 any file extensions. If an absolute name for PROG cannot be found, 244 any file extensions. If an absolute name for PROG cannot be found,
245 return NULL. */ 245 return NULL. */
246 char * 246 char *
247 make_absolute (char *prog) 247 make_absolute (char *prog)
248 { 248 {
270 return strdup (absname); 270 return strdup (absname);
271 else 271 else
272 return NULL; 272 return NULL;
273 } 273 }
274 274
275 if (GetCurrentDirectory (MAX_PATH, curdir) <= 0) 275 if (GetCurrentDirectory (MAX_PATH, curdir) <= 0)
276 return NULL; 276 return NULL;
277 277
278 /* Relative path; search in current dir. */ 278 /* Relative path; search in current dir. */
279 if (strpbrk (prog, "\\")) 279 if (strpbrk (prog, "\\"))
280 { 280 {
281 if (search_dir (curdir, prog, MAX_PATH, absname) > 0) 281 if (search_dir (curdir, prog, MAX_PATH, absname) > 0)
282 return strdup (absname); 282 return strdup (absname);
283 else 283 else
284 return NULL; 284 return NULL;
285 } 285 }
286 286
287 /* Just filename; search current directory then PATH. */ 287 /* Just filename; search current directory then PATH. */
288 path = alloca (strlen (getenv ("PATH")) + strlen (curdir) + 2); 288 path = alloca (strlen (getenv ("PATH")) + strlen (curdir) + 2);
289 strcpy (path, curdir); 289 strcpy (path, curdir);
290 strcat (path, ";"); 290 strcat (path, ";");
291 strcat (path, getenv ("PATH")); 291 strcat (path, getenv ("PATH"));
302 if (search_dir (dir, prog, MAX_PATH, absname) > 0) 302 if (search_dir (dir, prog, MAX_PATH, absname) > 0)
303 return strdup (absname); 303 return strdup (absname);
304 304
305 /* Move to the next directory. */ 305 /* Move to the next directory. */
306 path = p + 1; 306 path = p + 1;
307 } 307 }
308 308
309 return NULL; 309 return NULL;
310 } 310 }
311 311
312 /*****************************************************************/ 312 /*****************************************************************/
320 setup_argv (void) 320 setup_argv (void)
321 { 321 {
322 char * cmdline = GetCommandLine (); 322 char * cmdline = GetCommandLine ();
323 int arg_bytes = 0; 323 int arg_bytes = 0;
324 324
325 325
326 } 326 }
327 #endif 327 #endif
328 328
329 /* Information about child proc is global, to allow for automatic 329 /* Information about child proc is global, to allow for automatic
330 termination when interrupted. At the moment, only one child process 330 termination when interrupted. At the moment, only one child process
382 char * envblock = GetEnvironmentStrings (); 382 char * envblock = GetEnvironmentStrings ();
383 383
384 sec_attrs.nLength = sizeof (sec_attrs); 384 sec_attrs.nLength = sizeof (sec_attrs);
385 sec_attrs.lpSecurityDescriptor = NULL; 385 sec_attrs.lpSecurityDescriptor = NULL;
386 sec_attrs.bInheritHandle = FALSE; 386 sec_attrs.bInheritHandle = FALSE;
387 387
388 memset (&start, 0, sizeof (start)); 388 memset (&start, 0, sizeof (start));
389 start.cb = sizeof (start); 389 start.cb = sizeof (start);
390 390
391 if (CreateProcess (progname, cmdline, &sec_attrs, NULL, TRUE, 391 if (CreateProcess (progname, cmdline, &sec_attrs, NULL, TRUE,
392 0, envblock, dir, &start, &child)) 392 0, envblock, dir, &start, &child))