summaryrefslogtreecommitdiff
path: root/libntp/ntp_lineedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'libntp/ntp_lineedit.c')
-rw-r--r--libntp/ntp_lineedit.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libntp/ntp_lineedit.c b/libntp/ntp_lineedit.c
index c5aad31..e3bc002 100644
--- a/libntp/ntp_lineedit.c
+++ b/libntp/ntp_lineedit.c
@@ -178,23 +178,22 @@ ntp_readline(
if (NULL != line) {
if (*line) {
add_history(line);
- *pcount = strlen(line);
- } else {
- free(line);
- line = NULL;
}
+ *pcount = strlen(line);
}
#endif /* LE_READLINE */
#ifdef LE_EDITLINE
cline = el_gets(ntp_el, pcount);
- if (NULL != cline && *cline) {
+ if (NULL != cline) {
history(ntp_hist, &hev, H_ENTER, cline);
- *pcount = strlen(cline);
line = estrdup(cline);
- } else
+ } else if (*pcount == -1) {
line = NULL;
+ } else {
+ line = estrdup("");
+ }
#endif /* LE_EDITLINE */
#ifdef LE_NONE