summaryrefslogtreecommitdiff
path: root/libntp/ntp_lineedit.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2015-02-05 20:53:33 +0000
committerCy Schubert <cy@FreeBSD.org>2015-02-05 20:53:33 +0000
commitf7cba3a80d9ebefc57776fffd17a4ae68f72e494 (patch)
treedc1c5074828f0c5fafe2fb8f5599339dfdc5bc97 /libntp/ntp_lineedit.c
parent44a728f815af203cd7a91db83b06325818433463 (diff)
Notes
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 c5aad3108614..e3bc0022a292 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