/* 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 = " ";
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);
}
}