]> git.pond.sub.org Git - empserver/commitdiff
(execute): Clients can't reliably detect where a redirection ends
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 9 Dec 2007 17:06:03 +0000 (17:06 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 9 Dec 2007 17:06:03 +0000 (17:06 +0000)
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.

src/lib/player/player.c

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