/* -*-c-*-
*
- * $Id: xgetline.c,v 1.8 1998/12/16 19:58:53 mdw Exp $
+ * $Id: xgetline.c,v 1.9 1999/05/05 18:54:37 mdw Exp $
*
* Fetch a line of text from the user
*
/*----- Revision history --------------------------------------------------*
*
* $Log: xgetline.c,v $
+ * Revision 1.9 1999/05/05 18:54:37 mdw
+ * Keep blank lines out of the history list.
+ *
* Revision 1.8 1998/12/16 19:58:53 mdw
* Stop the dropdown list from dropping down when you press enter.
*
/* --- If history is enabled, output a new history file --- *
*
- * If the first entry was accepted verbatim, don't bother.
+ * If the first entry was accepted verbatim, or if the entry is a blank
+ * line, don't bother.
*/
- if (f & f_history && !(hist && strcmp(p, hist->data) == 0)) {
+ if (f & f_history && *p && !(hist && strcmp(p, hist->data) == 0)) {
int fd;
FILE *fp;
int i;
fputc('\n', fp);
for (i = 1, g = hist; (histmax < 1 || i < histmax) && g; g = g->next) {
- if (strcmp(g->data, p) != 0) {
+ if (*(char *)g->data && strcmp(g->data, p) != 0) {
fputs(g->data, fp);
fputc('\n', fp);
i++;