summaryrefslogtreecommitdiff
path: root/libntp/ntp_lineedit.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-04-07 08:29:34 +0000
committer <>2015-04-13 18:52:43 +0000
commitb2ccf8dd31d1457ae9f0ae270054117179220370 (patch)
tree4ccd4a16d5e9ef5869630ba624e822665a6e248c /libntp/ntp_lineedit.c
parentbdab5265fcbf3f472545073a23f8999749a9f2b9 (diff)
downloadntp-b2ccf8dd31d1457ae9f0ae270054117179220370.tar.gz
Imported from /home/lorry/working-area/delta_ntp/ntp-4.2.8p2.tar.gz.HEADntp-4.2.8p2master
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