| @@ -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 |
38 | static char sccsid[] = "@(#)ttgeneric.c 8.1 (Berkeley) 6/6/93"; | | 38 | static 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 | |
50 | char PC, *BC, *UP; | | 50 | char PC, *BC, *UP; |
51 | short ospeed; | | 51 | short 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) |
159 | void | | 159 | void |
160 | gen_setmodes(int new) | | 160 | gen_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) { |