do nothing with blank lines, exit on EOF
authorArt Cancro <ajc@citadel.org>
Wed, 30 Oct 2019 19:26:05 +0000 (15:26 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 30 Oct 2019 19:26:05 +0000 (15:26 -0400)
ctdlsh/main.c

index 00ca508..69d7f77 100644 (file)
@@ -146,9 +146,11 @@ void do_main_loop(int server_socket)
        rl_attempted_completion_function = ctdlsh_completion;
 
        /* Here we go ... main command loop */
-       while ( (cmd = readline(prompt)) , ((cmd) && (*cmd)) ) {
-               add_history(cmd);
-               ret = do_one_command(server_socket, cmd);
+       while ( (cmd = readline(prompt)) , cmd ) {
+               if (*cmd) {
+                       add_history(cmd);
+                       ret = do_one_command(server_socket, cmd);
+               }
                free(cmd);
        }
 }