Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 456 → Rev 457

/svarcom/trunk/command.c
268,26 → 268,14
}
 
 
static void run_as_external(const char far *cmdline) {
char buff[256];
char const *argvlist[256];
int i, n;
/* copy buffer to a near var (incl. trailing CR), insert a space before
every slash to make sure arguments are well separated */
n = 0;
i = 0;
for (;;) {
if (cmdline[i] == '/') buff[n++] = ' ';
buff[n++] = cmdline[i++];
if (buff[n] == 0) break;
}
static void run_as_external(char *buff, const char far *cmdline) {
char const **argvlist = (void *)(buff + 512);
 
cmd_explode(buff, cmdline, argvlist);
 
/* for (i = 0; argvlist[i] != NULL; i++) printf("arg #%d = '%s'\r\n", i, argvlist[i]); */
 
/* must be an external command then. this call should never return, unless
* the other program failed to be executed. */
/* this call should never return, unless the program failed to be executed */
execvp(argvlist[0], argvlist);
}
 
480,7 → 468,7
}
 
/* if here, then this was not an internal command */
run_as_external(cmdline);
run_as_external(BUFFER, cmdline);
 
/* revert stdout (in case it was redirected) */
redir_revert();
/svarcom/trunk/todo.txt
12,7 → 12,6
 
pipes redirections
basic BAT support (without workflow controls, FOR loops etc)
COMSPEC self-setting does not work under MS-DOS 5/6 (no exepath in env block)
 
 
AT SOME LATER TIME:
34,6 → 33,7
INT 2F,AX=5500 support
 
stdout redirection should not create the output file if command fails
COMSPEC self-setting does not work under MS-DOS 5/6 (no exepath in env block)
 
when execing an external command make sure to sync local environment (or run the program with a custom environment pointer?)