summaryrefslogtreecommitdiff
path: root/mail/ja-mh/patches/patch-al
blob: 52d168d4900e8ff97924cdff6dcc20c6ae1f3300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
$NetBSD: patch-al,v 1.3 2006/04/11 15:08:38 joerg Exp $

--- uip/vmh.c.orig	2006-04-11 14:16:00.000000000 +0000
+++ uip/vmh.c
@@ -113,13 +113,20 @@ void     __cputchar __P((int));
 #define	SMALLMOVE	1
 #define	LARGEMOVE	10
 
+#ifndef A_CHARTEXT
+#define	A_CHARTEXT	0xff
+#endif
 
 #define	XYZ			/* XXX */
 
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 5) || (defined(linux))
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 5) || (defined(linux)) || defined(__DragonFly__)
 struct ldat
 {
+#ifdef __DragonFly__
+	char		*text;
+#else
 	NCURSES_CH_T	*text;
+#endif
 	NCURSES_SIZE_T	firstchar;
 	NCURSES_SIZE_T	lastchar;
 	NCURSES_SIZE_T	oldindex;
@@ -222,6 +229,15 @@ static struct ltchars ltc;
 #endif
 #endif	/* TIOCGLTC */
 
+#ifdef __NetBSD__
+static char *tc_CE, *tc_CM, *tc_SO, *tc_SE, *tc_US, *tc_UE;
+#define	CE	tc_CE
+#define	CM	tc_CM
+#define	SO	tc_SO
+#define	SE	tc_SE
+#define	US	tc_US
+#define	UE	tc_UE
+#endif
 
 #if !defined(SYS5) && !defined(BSD44) && !defined(TERMINFO)
 int	_putchar ();
@@ -239,7 +255,6 @@ static TYPESIG	TSTPser ();
 
 
 					/* MISCELLANY */
-extern int  errno;
 #if !defined(BSD44) && !defined(__GNU_LIBRARY__)
 extern int  sys_nerr;
 extern char *sys_errlist[];
@@ -348,7 +363,11 @@ static  vmh () {
 	wclrtoeol (Command);
 	wrefresh (Command);
 
-	switch (WINgetstr (Command, buffer)) {
+#ifndef JAPAN
+	switch (WINgetstr (Command, buffer, sizeof(buffer))) {
+#else
+	switch (WINgetstr (Command, (unsigned char *)buffer, sizeof(buffer))) {
+#endif
 	    case NOTOK: 
 		break;
 
@@ -808,6 +827,9 @@ static int  WINinit (nprog) {
     sideground ();
 
 #ifndef	TERMINFO
+#ifdef __NetBSD__
+    CM = getcap("cm");
+#endif
     if (CM == NULL)
 #else	/* TERMINFO */
     if (cursor_address == NULL)	/* assume mtr wanted "cm", not "CM" */
@@ -822,6 +844,15 @@ static int  WINinit (nprog) {
 #ifndef	TERMINFO
     if (tgetflag ("xt") || tgetnum ("sg") > 0)
 	SO = SE = US = UE = NULL;
+#ifdef __NetBSD__
+    else {
+	SO = getcap("so");
+	SE = getcap("se");
+	US = getcap("us");
+	UE = getcap("ue");
+    }
+    CE = getcap("ce");
+#endif
 #else	/* TERMINFO */
 /*
  * If termcap mapped directly to terminfo, we'd use the following:
@@ -862,21 +893,36 @@ static int  WINinit (nprog) {
 
 /*  */
 
-static int WINgetstr (w, buffer)
+static int WINgetstr (w, buffer, size)
 register WINDOW *w;
+#ifndef JAPAN
 char   *buffer;
+#else	/* JAPAN */
+unsigned char   *buffer;
+#endif	/* JAPAN */
+size_t    size;
 {
     register int    c;
+#ifndef JAPAN
     register char  *bp;
+#else	/* JAPAN */
+    register unsigned char  *bp;
+#endif	/* JAPAN */
 
     bp = buffer;
     *bp = 0;
+    --size;
 
     for (;;) {
-	switch (c = wgetch (w) & 0xff) {
-	    case ERR: 
-		adios (NULLCP, "wgetch lost");
+	c = wgetch(w);
+	if (c == ERR)
+	    adios (NULLCP, "wgetch lost");
+	if (bp - buffer >= size &&
+	    !(c == intrc || c == EOFC || c == ERASE || c == KILL ||
+	      c == WERASC || c == '\r' || c == '\n'))
+	    continue;
 
+	switch (c &= A_CHARTEXT) {
 	    case '\f':
 		wrefresh (curscr);
 		break;
@@ -1382,7 +1428,7 @@ WINDOW *w;
 	    lp -> l_buf[i] = w -> lines[getcury(w)] -> line[i].ch;
 #else
 	    wmove(w, getcury(w), i);
-	    lp -> l_buf[i] = winch(w); /* 8bit ?? */
+	    lp -> l_buf[i] = winch(w) & A_CHARTEXT;
 #endif
 	}
 	lp -> l_buf[getmaxx(w)] = '\0';
@@ -1413,8 +1459,12 @@ WINDOW *w;
     }
 #endif /* __NCURSES_H */
     for (cp = lp -> l_buf + strlen (lp -> l_buf) - 1; cp >= lp -> l_buf; cp--)
+#ifndef JAPAN
 	if (isspace (*cp))
-	    *cp = 0;
+#else	/* JAPAN */
+	if (isspace ((unsigned char)(*cp)))
+#endif	/* JAPAN */
+	    *cp = '\0';
 	else
 	    break;
 
@@ -1579,7 +1629,9 @@ static	TTYoff () {
 
     INTR = intrc;
 #ifndef	SYS5
+#ifndef __NetBSD__
     (void) ioctl (fileno (stdin), TIOCSETC, (char *) &tc);
+#endif
 #else	/* SYS5 */
 #if defined(TCGETATTR) && !defined(TCSETA) && defined(TCSANOW)
     (void) tcsetattr (fileno (stdin), TCSANOW, &sg);
@@ -1591,6 +1643,9 @@ static	TTYoff () {
     leaveok (curscr, TRUE);
     mvcur (0, COLS - 1, LINES - 1, 0);
     endwin ();
+#ifdef __NetBSD__
+    (void) ioctl (fileno (stdin), TIOCSETC, (char *) &tc);
+#endif
     if (tty_ready == DONE) {
 #ifndef	TERMINFO
 	if (CE)