]> git.pond.sub.org Git - empserver/blobdiff - src/lib/player/player.c
(execute): Use player->comtail[1] instead of player->argp[1]. This
[empserver] / src / lib / player / player.c
index 9f57dbf281abd55433fbcee37cf206e275012f54..89f63a7d0e033d2d606292ab50b297b3147546ae 100644 (file)
  */
 
 #include <config.h>
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
 
+#include <errno.h>
+#include <stdio.h>
 #include "com.h"
 #include "empio.h"
 #include "empthread.h"
@@ -49,7 +45,6 @@
 #include "optlist.h"
 #include "player.h"
 #include "proto.h"
-#include "proto.h"
 #include "prototypes.h"
 #include "sect.h"
 #include "tel.h"
@@ -146,8 +141,8 @@ command(void)
 
     if (getcommand(player->combuf) < 0)
        return 0;
-    if (parse(player->combuf, player->argp, &player->condarg,
-             scanspace, &redir) < 0) {
+    if (parse(player->combuf, scanspace, player->argp, player->comtail,
+             &player->condarg, &redir) < 0) {
        pr("See \"info Syntax\"?\n");
     } else {
        if (dispatch(player->combuf, redir) < 0)
@@ -283,19 +278,19 @@ execute(void)
     failed = 0;
     redir = NULL;
 
-    p = getstarg(player->argp[1], "File? ", buf);
-
+    if (player->comtail[1])
+       p = player->comtail[1];
+    else
+       p = getstring("File? ", buf);
     if (p == NULL || *p == '\0')
        return RET_SYN;
-
-    /* FIXME should use raw argument here, to support UTF-8 file names */
-    prexec(player->argp[1]);
+    prexec(p);
 
     while (!failed && status()) {
        if (recvclient(buf, sizeof(buf)) < 0)
            break;
-       if (parse(buf, player->argp, &player->condarg,
-                 scanspace, &redir) < 0) {
+       if (parse(buf, scanspace, player->argp, player->comtail,
+                 &player->condarg, &redir) < 0) {
            failed = 1;
            continue;
        }
@@ -309,6 +304,7 @@ execute(void)
     }
     if (redir == NULL)
        pr("Execute : %s\n", failed ? "aborted" : "terminated");
+    player->eof = 0;
     return RET_OK;
 }