Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ntp/dist/libntp fix lineedit functionality. ntp...



details:   https://anonhg.NetBSD.org/src/rev/f29cbb5b51a8
branches:  trunk
changeset: 766254:f29cbb5b51a8
user:      kardel <kardel%NetBSD.org@localhost>
date:      Sun Jun 19 15:58:07 2011 +0000

description:
fix lineedit functionality. ntpq and friends would just exit on empty lines
which is not intended - there is a quit command for that purpose.

diffstat:

 external/bsd/ntp/dist/libntp/ntp_lineedit.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 713c84671f0c -r f29cbb5b51a8 external/bsd/ntp/dist/libntp/ntp_lineedit.c
--- a/external/bsd/ntp/dist/libntp/ntp_lineedit.c       Sun Jun 19 15:52:48 2011 +0000
+++ b/external/bsd/ntp/dist/libntp/ntp_lineedit.c       Sun Jun 19 15:58:07 2011 +0000
@@ -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 */
 



Home | Main Index | Thread Index | Old Index