return 1;
}
+/*
+ * Return 1 if OK
+ * 0 if no input
+ * -1 error (must stop)
+ */
int
get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec)
{
*/
line = readline((char *)prompt); /* cast needed for old readlines */
if (!line) {
- exit(1);
+ return -1; /* error return and exit */
}
strip_trailing_junk(line);
command = line;
sendit(_("Command logic problem\n"));
sock->msglen = 0;
sock->msg[0] = 0;
- return 0;
+ return 0; /* No input */
}
/*
actuallyfree(line); /* allocated by readline() malloc */
line = NULL;
}
- return 1;
+ return 1; /* OK */
}
#else /* no readline, do it ourselves */
int ret=0;
#ifdef HAVE_READLINE
-/* first, try to truncate the history file, and if it
- * fail, the file is probably not present, and we
+/*
+ * first, try to truncate the history file, and if it
+ * fails, the file is probably not present, and we
* can use write_history to create it
*/
} else {
ret = write_history(histfile);
}
-
#endif
return ret;
int ret=0;
#ifdef HAVE_READLINE
-
using_history();
ret = read_history(histfile);
/* Tell the completer that we want a complete . */