Module Name: src
Committed By: kardel
Date: Sun Jun 19 15:58:07 UTC 2011
Modified Files:
src/external/bsd/ntp/dist/libntp: ntp_lineedit.c
Log Message:
fix lineedit functionality. ntpq and friends would just exit on empty lines
which is not intended - there is a quit command for that purpose.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/ntp_lineedit.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/ntp/dist/libntp/ntp_lineedit.c
diff -u src/external/bsd/ntp/dist/libntp/ntp_lineedit.c:1.1.1.1 src/external/bsd/ntp/dist/libntp/ntp_lineedit.c:1.2
--- src/external/bsd/ntp/dist/libntp/ntp_lineedit.c:1.1.1.1 Sun Dec 13 16:55:02 2009
+++ src/external/bsd/ntp/dist/libntp/ntp_lineedit.c Sun Jun 19 15:58:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_lineedit.c,v 1.1.1.1 2009/12/13 16:55:02 kardel Exp $ */
+/* $NetBSD: ntp_lineedit.c,v 1.2 2011/06/19 15:58:07 kardel Exp $ */
/*
* ntp_lineedit.c - generic interface to various line editing libs
@@ -174,11 +174,8 @@
if (NULL != line) {
if (*line) {
add_history(line);
- *pcount = strlen(line);
- } else {
- free(line);
- line = NULL;
}
+ *pcount = strlen(line);
}
#endif /* HAVE_READLINE_HISTORY */
@@ -187,12 +184,14 @@
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 /* !HAVE_READLINE_HISTORY && HAVE_HISTEDIT_H */