Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Extend does_ctrl_o() to compare exit attribute...



details:   https://anonhg.NetBSD.org/src/rev/36ae5144a4aa
branches:  trunk
changeset: 786653:36ae5144a4aa
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sun May 05 14:24:05 2013 +0000

description:
Extend does_ctrl_o() to compare exit attribute and ext ACS sequences.

diffstat:

 lib/libcurses/setterm.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (67 lines):

diff -r 3f6b29ed6102 -r 36ae5144a4aa lib/libcurses/setterm.c
--- a/lib/libcurses/setterm.c   Sun May 05 14:23:16 2013 +0000
+++ b/lib/libcurses/setterm.c   Sun May 05 14:24:05 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setterm.c,v 1.49 2012/04/21 12:27:28 roy Exp $ */
+/*     $NetBSD: setterm.c,v 1.50 2013/05/05 14:24:05 jdc Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setterm.c  8.8 (Berkeley) 10/25/94";
 #else
-__RCSID("$NetBSD: setterm.c,v 1.49 2012/04/21 12:27:28 roy Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.50 2013/05/05 14:24:05 jdc Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,7 @@
 #include "curses_private.h"
 
 static int does_esc_m(const char *cap);
-static int does_ctrl_o(const char *cap);
+static int does_ctrl_o(const char *exit_cap, const char *acs_cap);
 
 attr_t  __mask_op, __mask_me, __mask_ue, __mask_se;
 
@@ -172,7 +172,8 @@
         * It might turn off ACS, so check for that.
         */
        if (t_exit_attribute_mode(screen->term) != NULL &&
-           does_ctrl_o(t_exit_attribute_mode(screen->term)))
+           does_ctrl_o(t_exit_attribute_mode(screen->term),
+           t_exit_alt_charset_mode(screen->term)))
                screen->mask_me = 0;
        else
                screen->mask_me = __ALTCHARSET;
@@ -330,20 +331,22 @@
 /*
  * does_ctrl_o --
  * A hack for vt100/xterm-like terminals where the "me" capability also
- * unsets acs (i.e. it contains the character '\017').
+ * unsets acs.
  */
 static int
-does_ctrl_o(const char *cap)
+does_ctrl_o(const char *exit_cap, const char *acs_cap)
 {
-       const char *capptr = cap;
+       const char *eptr = exit_cap, *aptr = acs_cap;
+       int l;
 
 #ifdef DEBUG
-       __CTRACE(__CTRACE_INIT, "does_ctrl_o: Looping on %s\n", capptr);
+       __CTRACE(__CTRACE_INIT, "does_ctrl_o: Testing %s for %s\n", eptr, aptr);
 #endif
-       while (*capptr != 0) {
-               if (*capptr == '\x0f')
+       l = strlen(acs_cap);
+       while (*eptr != 0) {
+               if (!strncmp(eptr, aptr, l))
                        return 1;
-               capptr++;
+               eptr++;
        }
        return 0;
 }



Home | Main Index | Thread Index | Old Index