Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 576 → Rev 577

/svarcom/trunk/command.c
871,7 → 871,7
rmod_updatecomspecptr(rmod->rmodseg, *rmod_envseg);
 
/* handle redirections (if any) */
i = redir_parsecmd(&redirprops, cmdline, rmod->awaitingcmd);
i = redir_parsecmd(&redirprops, cmdline, rmod->awaitingcmd, *rmod_envseg);
if (i != 0) {
nls_outputnl_doserr(i);
rmod->awaitingcmd[0] = 0;
/svarcom/trunk/redir.c
34,14 → 34,23
 
 
/* compute a filename to be used for pipes */
static unsigned short gentmpfile(char *s) {
static unsigned short gentmpfile(char *s, unsigned short envseg) {
unsigned short err = 0;
unsigned short i;
 
/* do I have a %temp% path? */
/* TODO */
i = env_lookup_valcopy(s, 116, envseg, "TEMP");
if (i > 0) {
/* make sure it is terminated by a backslash (required by int 0x21, ah=5a) */
if (s[i - 1] != '\\') {
s[i++] = '\\';
s[i] = 0;
}
} else {
/* if fails, then use truename(.\) */
if (file_truename(".\\", s) != 0) *s = 0;
}
 
/* if fails, then use truename(\) */
if (file_truename(".\\", s) != 0) *s = 0;
 
/* create file */
_asm {
mov ah, 0x5a
66,7 → 75,7
* modified so all redirections are cut out.
* piped commands are moved to awaitingcmd for later execution
* returns 0 on success, DOS err on failure */
unsigned short redir_parsecmd(struct redir_data *d, char *cmdline, char far *awaitingcmd) {
unsigned short redir_parsecmd(struct redir_data *d, char *cmdline, char far *awaitingcmd, unsigned short envseg) {
unsigned short i;
unsigned short pipescount = 0;
 
135,16 → 144,12
}
/* redirect stdin of next command from a temp file (that is used as my output) */
_fstrcat(awaitingcmd, "<");
i = gentmpfile(tmpfile);
i = gentmpfile(tmpfile, envseg);
if (i != 0) return(i);
_fstrcat(awaitingcmd, tmpfile);
/* same file is used as my stdout */
d->stdoutfile = tmpfile;
d->stdout_openflag = 0x12;
/* TODO I need to remember that the tmp file must be removed... */
/* outputnl("awaitingcmd:");
for (i = 0; awaitingcmd[i] != 0; i++) printf("%c", awaitingcmd[i]);
printf("\r\n");*/
}
return(0);
}
/svarcom/trunk/redir.h
36,9 → 36,9
 
/* parse commandline and performs necessary redirections. cmdline is
* modified so all redirections are cut out.
* piped commands are move to awaitingcmd for later execution
* piped commands are moved to awaitingcmd for later execution and a temporary file is created (either in current directory or in %TEMP%, if the latter is defined)
* returns 0 on success, DOS err on failure */
unsigned short redir_parsecmd(struct redir_data *d, char *cmdline, char far *awaitingcmd);
unsigned short redir_parsecmd(struct redir_data *d, char *cmdline, char far *awaitingcmd, unsigned short envseg);
 
/* apply stdin/stdout redirections defined in redir_data, returns 0 on success */
int redir_apply(const struct redir_data *d);
/svarcom/trunk/todo.txt
7,7 → 7,6
 
=== HIGH PRIORITY ============================================================
 
write temporary pipe files to %TEMP% if defined
int 24h handler (abort, retry, fail, ignore)
advanced batch constructs: CALL, FOR, GOTO
IF EXIST on an empty drive should not lead to the 'Abort, Retry, Fail' prompt