Wed Jun 17 20:30:59 2009 UTC ()
Pull up following revision(s) (requested by christos in ticket #813):
	usr.bin/window/ttgeneric.c: revision 1.11
PR/41581: Der mouse: window SEGV with certain terminals. does strcmp first
and then checks for null pointer for underline and bold.


(bouyer)
diff -r1.9 -r1.9.40.1 src/usr.bin/window/ttgeneric.c

cvs diff -r1.9 -r1.9.40.1 src/usr.bin/window/Attic/ttgeneric.c (expand / switch to unified diff)

--- src/usr.bin/window/Attic/ttgeneric.c 2003/08/07 11:17:30 1.9
+++ src/usr.bin/window/Attic/ttgeneric.c 2009/06/17 20:30:59 1.9.40.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ttgeneric.c,v 1.9 2003/08/07 11:17:30 agc Exp $ */ 1/* $NetBSD: ttgeneric.c,v 1.9.40.1 2009/06/17 20:30:59 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1993 4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Edward Wang at The University of California, Berkeley. 8 * Edward Wang at The University of California, Berkeley.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36#ifndef lint 36#ifndef lint
37#if 0 37#if 0
38static char sccsid[] = "@(#)ttgeneric.c 8.1 (Berkeley) 6/6/93"; 38static char sccsid[] = "@(#)ttgeneric.c 8.1 (Berkeley) 6/6/93";
39#else 39#else
40__RCSID("$NetBSD: ttgeneric.c,v 1.9 2003/08/07 11:17:30 agc Exp $"); 40__RCSID("$NetBSD: ttgeneric.c,v 1.9.40.1 2009/06/17 20:30:59 bouyer Exp $");
41#endif 41#endif
42#endif /* not lint */ 42#endif /* not lint */
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45#include <string.h> 45#include <string.h>
46#include <termcap.h> 46#include <termcap.h>
47#include "ww.h" 47#include "ww.h"
48#include "tt.h" 48#include "tt.h"
49 49
50char PC, *BC, *UP; 50char PC, *BC, *UP;
51short ospeed; 51short ospeed;
52 52
53 /* normal frame */ 53 /* normal frame */
@@ -159,40 +159,40 @@ gen_setinsert(char new) @@ -159,40 +159,40 @@ gen_setinsert(char new)
159void 159void
160gen_setmodes(int new) 160gen_setmodes(int new)
161{ 161{
162 int diff; 162 int diff;
163 163
164 diff = new ^ tt.tt_modes; 164 diff = new ^ tt.tt_modes;
165 if (diff & WWM_REV) { 165 if (diff & WWM_REV) {
166 if (new & WWM_REV) { 166 if (new & WWM_REV) {
167 if (gen_SO) 167 if (gen_SO)
168 ttxputs(gen_SO); 168 ttxputs(gen_SO);
169 } else 169 } else
170 if (gen_SE) { 170 if (gen_SE) {
171 ttxputs(gen_SE); 171 ttxputs(gen_SE);
172 if (!strcmp(gen_SE->ts_str, gen_UE->ts_str) && 172 if (gen_UE && gen_US && new & WWM_UL &&
173 gen_UE && gen_US && new & WWM_UL) 173 !strcmp(gen_SE->ts_str, gen_UE->ts_str))
174 ttxputs(gen_US); 174 ttxputs(gen_US);
175 } 175 }
176 } 176 }
177 if (diff & WWM_UL) { 177 if (diff & WWM_UL) {
178 if (new & WWM_UL) { 178 if (new & WWM_UL) {
179 if (gen_US) 179 if (gen_US)
180 ttxputs(gen_US); 180 ttxputs(gen_US);
181 } else 181 } else
182 if (gen_UE) { 182 if (gen_UE) {
183 ttxputs(gen_UE); 183 ttxputs(gen_UE);
184 if (!strcmp(gen_UE->ts_str, gen_SE->ts_str) && 184 if (gen_SE && gen_SO && new & WWM_REV &&
185 gen_SE && gen_SO && new & WWM_REV) 185 !strcmp(gen_UE->ts_str, gen_SE->ts_str))
186 ttxputs(gen_SO); 186 ttxputs(gen_SO);
187 } 187 }
188 } 188 }
189 if (diff & WWM_GRP) { 189 if (diff & WWM_GRP) {
190 if (new & WWM_GRP) { 190 if (new & WWM_GRP) {
191 if (gen_AS) 191 if (gen_AS)
192 ttxputs(gen_AS); 192 ttxputs(gen_AS);
193 } else 193 } else
194 if (gen_AE) 194 if (gen_AE)
195 ttxputs(gen_AE); 195 ttxputs(gen_AE);
196 } 196 }
197 if (diff & WWM_USR) { 197 if (diff & WWM_USR) {
198 if (new & WWM_USR) { 198 if (new & WWM_USR) {