Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit/TEST \033 is more portable than \e still.



details:   https://anonhg.NetBSD.org/src/rev/3bf7b4b6628a
branches:  trunk
changeset: 754071:3bf7b4b6628a
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 18 21:17:47 2010 +0000

description:
\033 is more portable than \e still.

diffstat:

 lib/libedit/TEST/tc1.c  |  15 ++++++++-------
 lib/libedit/TEST/wtc1.c |   2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diffs (68 lines):

diff -r 5e9a39b12201 -r 3bf7b4b6628a lib/libedit/TEST/tc1.c
--- a/lib/libedit/TEST/tc1.c    Sun Apr 18 21:17:22 2010 +0000
+++ b/lib/libedit/TEST/tc1.c    Sun Apr 18 21:17:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tc1.c,v 1.4 2010/04/15 00:50:46 christos Exp $ */
+/*     $NetBSD: tc1.c,v 1.5 2010/04/18 21:17:47 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)test.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tc1.c,v 1.4 2010/04/15 00:50:46 christos Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.5 2010/04/18 21:17:47 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -72,7 +72,7 @@
 static char *
 prompt(EditLine *el)
 {
-       static char a[] = "\1\e[7m\1Edit$\1\e[0m\1 ";
+       static char a[] = "\1\033[7m\1Edit$\1\033[0m\1 ";
        static char b[] = "Edit> ";
 
        return (continuation ? b : a);
@@ -92,6 +92,7 @@
        const char* ptr;
        const LineInfo *lf = el_line(el);
        int len;
+       int res = CC_ERROR;
 
        /*
         * Find the last word
@@ -105,16 +106,16 @@
                if (len > strlen(dp->d_name))
                        continue;
                if (strncmp(dp->d_name, ptr, len) == 0) {
-                       closedir(dd);
                        if (el_insertstr(el, &dp->d_name[len]) == -1)
-                               return (CC_ERROR);
+                               res = CC_ERROR;
                        else
-                               return (CC_REFRESH);
+                               res = CC_REFRESH;
+                       break;
                }
        }
 
        closedir(dd);
-       return (CC_ERROR);
+       return res;
 }
 
 int
diff -r 5e9a39b12201 -r 3bf7b4b6628a lib/libedit/TEST/wtc1.c
--- a/lib/libedit/TEST/wtc1.c   Sun Apr 18 21:17:22 2010 +0000
+++ b/lib/libedit/TEST/wtc1.c   Sun Apr 18 21:17:47 2010 +0000
@@ -18,7 +18,7 @@
 static wchar_t *
 prompt(EditLine *el)
 {
-       static wchar_t a[] = L"\1\e[7m\1Edit$\1\e[0m\1 ";
+       static wchar_t a[] = L"\1\033[7m\1Edit$\1\033[0m\1 ";
        static wchar_t b[] = L"Edit> ";
 
        return continuation ? b : a;



Home | Main Index | Thread Index | Old Index