]> git.pond.sub.org Git - empserver/commitdiff
(prompt, servercmd): Move C_PROMPT code from prompt() to the only call
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 29 Nov 2007 05:17:54 +0000 (05:17 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 29 Nov 2007 05:17:54 +0000 (05:17 +0000)
site that passes C_PROMPT.  No functional change.

src/client/servcmd.c

index 0e17a770ad502623f63274f3284595bc11fdb0db..da73d56bd7ea23eb9fd229e2cb77146eac3477b7 100644 (file)
@@ -73,6 +73,17 @@ servercmd(int code, char *arg, int len)
        }
        snprintf(the_prompt, sizeof(the_prompt), "[%d:%d] Command : ",
                 nmin, nbtu);
+       if (redir_fp) {
+           (void)fclose(redir_fp);
+           redir_fp = NULL;
+       } else if (pipe_fp) {
+           (void)pclose(pipe_fp);
+           pipe_fp = NULL;
+       }
+       if (input_to_forget) {
+           forget_input(input_to_forget);
+           input_to_forget = 0;
+       }
        prompt(code, the_prompt, teles);
        executing = 0;
        break;
@@ -126,20 +137,6 @@ prompt(int code, char *prompt, char *teles)
 {
     char *nl;
 
-    if (code == C_PROMPT) {
-       if (redir_fp) {
-           (void)fclose(redir_fp);
-           redir_fp = NULL;
-       } else if (pipe_fp) {
-           (void)pclose(pipe_fp);
-           pipe_fp = NULL;
-       }
-       if (input_to_forget) {
-           forget_input(input_to_forget);
-           input_to_forget = 0;
-       }
-    }
-
     nl = code == C_PROMPT || code == C_INFORM ? "\n" : "";
     printf("%s%s%s", nl, teles, prompt);
     fflush(stdout);