Subversion Repositories SvarDOS

Rev

Rev 450 | Rev 458 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 450 Rev 457
Line 266... Line 266...
266
  }
266
  }
267
  *s = '$';
267
  *s = '$';
268
}
268
}
269
 
269
 
270
 
270
 
271
static void run_as_external(const char far *cmdline) {
271
static void run_as_external(char *buff, const char far *cmdline) {
272
  char buff[256];
-
 
273
  char const *argvlist[256];
272
  char const **argvlist = (void *)(buff + 512);
274
  int i, n;
-
 
275
  /* copy buffer to a near var (incl. trailing CR), insert a space before
-
 
276
     every slash to make sure arguments are well separated */
-
 
277
  n = 0;
-
 
278
  i = 0;
-
 
279
  for (;;) {
-
 
280
    if (cmdline[i] == '/') buff[n++] = ' ';
-
 
281
    buff[n++] = cmdline[i++];
-
 
282
    if (buff[n] == 0) break;
-
 
283
  }
-
 
284
 
273
 
285
  cmd_explode(buff, cmdline, argvlist);
274
  cmd_explode(buff, cmdline, argvlist);
286
 
275
 
287
  /* for (i = 0; argvlist[i] != NULL; i++) printf("arg #%d = '%s'\r\n", i, argvlist[i]); */
276
  /* for (i = 0; argvlist[i] != NULL; i++) printf("arg #%d = '%s'\r\n", i, argvlist[i]); */
288
 
277
 
289
  /* must be an external command then. this call should never return, unless
-
 
290
   * the other program failed to be executed. */
278
  /* this call should never return, unless the program failed to be executed */
291
  execvp(argvlist[0], argvlist);
279
  execvp(argvlist[0], argvlist);
292
}
280
}
293
 
281
 
294
 
282
 
295
static void set_comspec_to_self(unsigned short envseg) {
283
static void set_comspec_to_self(unsigned short envseg) {
Line 478... Line 466...
478
      redir_revert(); /* revert stdout (in case it was redirected) */
466
      redir_revert(); /* revert stdout (in case it was redirected) */
479
      continue;
467
      continue;
480
    }
468
    }
481
 
469
 
482
    /* if here, then this was not an internal command */
470
    /* if here, then this was not an internal command */
483
    run_as_external(cmdline);
471
    run_as_external(BUFFER, cmdline);
484
 
472
 
485
    /* revert stdout (in case it was redirected) */
473
    /* revert stdout (in case it was redirected) */
486
    redir_revert();
474
    redir_revert();
487
 
475
 
488
    /* execvp() replaces the current process by the new one
476
    /* execvp() replaces the current process by the new one