(execute): Clients can't reliably detect where a redirection ends

because the server doesn't send C_PROMPT.  The client simply rejects
such redirections since servcmd.c rev. 1.42.  Before it didn't, but
incorrectly extended the redirection until the end of the script, and
screwed up when there was more than one redirection in the execute.
Make the server reject such redirections as well, because that's
probably more useful and certainly less painful than documenting this
mess.
This commit is contained in:
Markus Armbruster 2007-12-09 17:06:03 +00:00
parent 158f5f4b2a
commit ed8e0cd552

View file

@ -237,7 +237,6 @@ status(void)
} }
/* /*
* actually a command; redirection and piping ignored.
* XXX This whole mess should be redone; execute block should * XXX This whole mess should be redone; execute block should
* start with "exec start", and should end with "exec end". * start with "exec start", and should end with "exec end".
* We'll wait until 1.2 I guess. * We'll wait until 1.2 I guess.
@ -252,7 +251,6 @@ execute(void)
char scanspace[1024]; char scanspace[1024];
failed = 0; failed = 0;
redir = NULL;
if (player->comtail[1]) if (player->comtail[1])
p = player->comtail[1]; p = player->comtail[1];
@ -270,15 +268,16 @@ execute(void)
failed = 1; failed = 1;
continue; continue;
} }
if (redir == NULL)
pr("\nExecute : %s\n", buf); pr("\nExecute : %s\n", buf);
if (dispatch(buf, redir) < 0) if (redir) {
pr("Execute : redirection not supported\n");
failed = 1;
} else if (dispatch(buf, NULL) < 0)
failed = 1; failed = 1;
} }
if (failed) { if (failed) {
while (recvclient(buf, sizeof(buf)) >= 0) ; while (recvclient(buf, sizeof(buf)) >= 0) ;
} }
if (redir == NULL)
pr("Execute : %s\n", failed ? "aborted" : "terminated"); pr("Execute : %s\n", failed ? "aborted" : "terminated");
player->eof = 0; player->eof = 0;
return RET_OK; return RET_OK;