do nothing with blank lines, exit on EOF
[citadel.git] / ctdlsh / main.c
index 00ca50895a0ce2976b545337b4aed6def1279e3d..468c8b261dcd6a158b1ff6bdca542da680b7e73a 100644 (file)
@@ -91,6 +91,14 @@ char *command_generator(const char *text, int state)
 /* Auto-completer function */
 char **ctdlsh_completion(const char *text, int start, int end)
 {
+
+
+       printf("\033[7mcompletion: text='%s', start=%d, end=%d\033[0m\n", text, start , end);
+
+
+
+
+
        char **matches = (char **) NULL;
 
        rl_completer_word_break_characters = " ";
@@ -146,9 +154,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);
        }
 }