| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fancy.c,v 1.14 2009/08/12 05:17:57 dholland Exp $ */ | | 1 | /* $NetBSD: fancy.c,v 1.15 2020/04/22 23:36:26 joerg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1980, 1993 | | 4 | * Copyright (c) 1980, 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 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | #if 0 | | 34 | #if 0 |
35 | static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; | | 35 | static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; |
36 | #else | | 36 | #else |
37 | __RCSID("$NetBSD: fancy.c,v 1.14 2009/08/12 05:17:57 dholland Exp $"); | | 37 | __RCSID("$NetBSD: fancy.c,v 1.15 2020/04/22 23:36:26 joerg Exp $"); |
38 | #endif | | 38 | #endif |
39 | #endif /* not lint */ | | 39 | #endif /* not lint */ |
40 | | | 40 | |
41 | #include "back.h" | | 41 | #include "back.h" |
42 | | | 42 | |
43 | static void bsect(int, int, int, int); | | 43 | static void bsect(int, int, int, int); |
44 | static void fixpos(int, int, int, int, int); | | 44 | static void fixpos(int, int, int, int, int); |
45 | static void fixcol(int, int, int, int, int); | | 45 | static void fixcol(int, int, int, int, int); |
46 | static void newline(void); | | 46 | static void newline(void); |
47 | | | 47 | |
48 | /* | | 48 | /* |
49 | * These need to be declared so they come out as commons, because | | 49 | * These need to be declared so they come out as commons, because |
50 | * termcap might or might not define some of them. Our termcap defines | | 50 | * termcap might or might not define some of them. Our termcap defines |
| @@ -68,28 +68,26 @@ static int lHO; /* length of HO */ | | | @@ -68,28 +68,26 @@ static int lHO; /* length of HO */ |
68 | static int lBC; /* length of BC */ | | 68 | static int lBC; /* length of BC */ |
69 | static int lND; /* length of ND */ | | 69 | static int lND; /* length of ND */ |
70 | static int lUP; /* length of UP */ | | 70 | static int lUP; /* length of UP */ |
71 | static int CO; /* number of columns */ | | 71 | static int CO; /* number of columns */ |
72 | static int LI; /* number of lines */ | | 72 | static int LI; /* number of lines */ |
73 | static int *linect; /* array of lengths of lines on screen (the | | 73 | static int *linect; /* array of lengths of lines on screen (the |
74 | * actual screen is not stored) */ | | 74 | * actual screen is not stored) */ |
75 | | | 75 | |
76 | /* two letter codes */ | | 76 | /* two letter codes */ |
77 | static char tcap[] = "bccdceclcmhomcmlndup"; | | 77 | static char tcap[] = "bccdceclcmhomcmlndup"; |
78 | /* corresponding strings */ | | 78 | /* corresponding strings */ |
79 | static char **tstr[] = {&BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP}; | | 79 | static char **tstr[] = {&BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP}; |
80 | | | 80 | |
81 | int buffnum; /* pointer to output buffer */ | | | |
82 | | | | |
83 | static char tbuf[1024]; /* buffer for decoded termcap entries */ | | 81 | static char tbuf[1024]; /* buffer for decoded termcap entries */ |
84 | | | 82 | |
85 | static int oldb[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | | 83 | static int oldb[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
86 | 0, 0, 0, 0, 0, 0}; | | 84 | 0, 0, 0, 0, 0, 0}; |
87 | | | 85 | |
88 | static int oldr; | | 86 | static int oldr; |
89 | static int oldw; | | 87 | static int oldw; |
90 | /* "real" cursor positions, so it knows when to reposition. These are -1 if | | 88 | /* "real" cursor positions, so it knows when to reposition. These are -1 if |
91 | * curr and curc are accurate */ | | 89 | * curr and curc are accurate */ |
92 | static int realr; | | 90 | static int realr; |
93 | static int realc; | | 91 | static int realc; |
94 | | | 92 | |
95 | void | | 93 | void |