Module Name:    src
Committed By:   riz
Date:           Sat May 11 21:48:23 UTC 2013

Modified Files:
        src/lib/libcurses [netbsd-6]: setterm.c

Log Message:
Pull up following revision(s) (requested by jdc in ticket #885):
        lib/libcurses/setterm.c: revision 1.50
Extend does_ctrl_o() to compare exit attribute and ext ACS sequences.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.4.1 src/lib/libcurses/setterm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/setterm.c
diff -u src/lib/libcurses/setterm.c:1.48 src/lib/libcurses/setterm.c:1.48.4.1
--- src/lib/libcurses/setterm.c:1.48	Tue Oct  4 11:01:14 2011
+++ src/lib/libcurses/setterm.c	Sat May 11 21:48:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: setterm.c,v 1.48 2011/10/04 11:01:14 roy Exp $	*/
+/*	$NetBSD: setterm.c,v 1.48.4.1 2013/05/11 21:48:23 riz 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.48 2011/10/04 11:01:14 roy Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.48.4.1 2013/05/11 21:48:23 riz Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: setterm.c,v 1.48 2011/
 #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 @@ _cursesi_setterm(char *type, SCREEN *scr
 	 * 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_esc_m(const char *cap)
 /*
  * 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;
 }

Reply via email to