Minor whitespace fixes/cleanup

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2017-11-29 15:01:22 +01:00
parent 2a3b422137
commit ed37cef412
2 changed files with 12 additions and 3 deletions

View File

@ -49,7 +49,7 @@ int main(int argc, char *argv[] __attribute__ ((unused)))
doit = argc == 1;
if ((prompt = getenv("TESTPROMPT")) == NULL)
prompt = "testit> ";
prompt = "testit> ";
while ((p = readline(prompt)) != NULL) {
printf("\t\t\t|%s|\n", p);

View File

@ -654,22 +654,27 @@ static el_status_t h_search(void)
old_prompt = rl_prompt;
rl_prompt = "Search: ";
tty_puts(rl_prompt);
move = Repeat == NO_ARG ? prev_hist : next_hist;
p = editinput();
rl_prompt = old_prompt;
Searching = 0;
tty_puts(rl_prompt);
if (p == NULL && el_intr_pending > 0) {
el_intr_pending = 0;
clear_line();
return redisplay();
}
p = search_hist(p, move);
clear_line();
if (p == NULL) {
el_ring_bell();
return redisplay();
}
return do_insert_hist(p);
}
@ -1023,6 +1028,7 @@ static char *editinput(void)
break;
}
}
return NULL;
}
@ -1046,6 +1052,7 @@ static void hist_add(const char *p)
if ((s = strdup(p)) == NULL)
return;
if (H.Size < el_hist_size) {
H.Lines[H.Size++] = s;
} else {
@ -1272,8 +1279,10 @@ char *readline(const char *prompt)
return line;
}
/* Even though readline() itself adds history automatically, the user can also add
* lines. This is for compat with GNU Readline. */
/*
* Even though readline() itself adds history automatically, the user
* can also add lines. This is for compatibility with GNU Readline.
*/
void add_history(const char *p)
{
if (p == NULL || *p == '\0')