Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/korean/engdic/files/patch-screen.c
18161 views
1
--- screen.c.orig 1999-09-05 22:48:35.000000000 -0400
2
+++ screen.c 2013-08-30 13:56:48.000000000 -0400
3
@@ -45,6 +45,8 @@
4
5
#include <stdio.h>
6
#include <string.h>
7
+#include <term.h>
8
+#include <unistd.h>
9
10
#define TERMIOS 1
11
12
@@ -53,7 +55,9 @@
13
#else
14
#if TERMIOS
15
#include <termios.h>
16
+#ifndef TAB3
17
#define TAB3 0
18
+#endif
19
#include <sys/ioctl.h>
20
#else
21
#include <sgtty.h>
22
@@ -75,6 +79,7 @@
23
#endif
24
25
#include <setjmp.h>
26
+#include <stdlib.h>
27
#include "engdic.h"
28
29
volatile int reading;
30
@@ -131,8 +136,12 @@
31
/*extern*/ char PC; /* Pad character */
32
33
int back_scroll;
34
-char *tgetstr();
35
-char *tgoto();
36
+
37
+void bo_exit(void);
38
+void flush(void);
39
+int iread(int, char *, int);
40
+void so_exit(void);
41
+void ul_exit(void);
42
43
/*
44
* Change terminal to "raw mode", or restore to "normal" mode.
45
@@ -145,8 +154,7 @@
46
* etc. are NOT disabled.
47
* It doesn't matter whether an input \n is mapped to \r, or vice versa.
48
*/
49
-raw_mode(on)
50
- int on;
51
+void raw_mode(int on)
52
{
53
#if TERMIO || TERMIOS
54
55
@@ -245,7 +253,7 @@
56
/*
57
* Get terminal capabilities via termcap.
58
*/
59
-struct size_buf get_term()
60
+struct size_buf get_term(void)
61
{
62
char termbuf[2048];
63
char *sp;
64
@@ -260,8 +268,6 @@
65
#endif
66
static char sbuf[1024];
67
68
- char *getenv(), *strcpy();
69
-
70
struct size_buf sz_buf ;
71
72
/*
73
@@ -470,12 +476,12 @@
74
* terminal-specific screen manipulation.
75
*/
76
77
-int putchr();
78
+int putchr(int);
79
80
/*
81
* Initialize terminal
82
*/
83
-init()
84
+void init(void)
85
{
86
tputs(sc_init, sc_height, putchr);
87
}
88
@@ -483,7 +489,7 @@
89
/*
90
* Deinitialize terminal
91
*/
92
-deinit()
93
+void deinit(void)
94
{
95
tputs(sc_deinit, sc_height, putchr);
96
}
97
@@ -491,7 +497,7 @@
98
/*
99
* Home cursor (move to upper left corner of screen).
100
*/
101
-home()
102
+void home(void)
103
{
104
tputs(sc_home, 1, putchr);
105
}
106
@@ -500,13 +506,13 @@
107
* Add a blank line (called with cursor at home).
108
* Should scroll the display down.
109
*/
110
-add_line()
111
+void add_line(void)
112
{
113
tputs(sc_addline, sc_height, putchr);
114
}
115
116
int short_file; /* if file less than a screen */
117
-lower_left()
118
+void lower_left(void)
119
{
120
if (short_file) {
121
putchr('\r');
122
@@ -517,17 +523,9 @@
123
}
124
125
/*
126
- * Ring the terminal bell.
127
- */
128
-bell()
129
-{
130
- putchr('\7');
131
-}
132
-
133
-/*
134
* Clear the screen.
135
*/
136
-clear()
137
+void clear(void)
138
{
139
if (mode_flags & M_SO)
140
so_exit();
141
@@ -542,7 +540,7 @@
142
* Clear from the cursor to the end of the cursor's line.
143
* {{ This must not move the cursor. }}
144
*/
145
-clear_eol()
146
+void clear_eol(void)
147
{
148
if (mode_flags & M_SO)
149
so_exit();
150
@@ -556,7 +554,7 @@
151
/*
152
* Begin "standout" (bold, underline, or whatever).
153
*/
154
-so_enter()
155
+void so_enter(void)
156
{
157
tputs(sc_s_in, 1, putchr);
158
mode_flags |= M_SO;
159
@@ -565,7 +563,7 @@
160
/*
161
* End "standout".
162
*/
163
-so_exit()
164
+void so_exit(void)
165
{
166
tputs(sc_s_out, 1, putchr);
167
mode_flags &= ~M_SO;
168
@@ -575,7 +573,7 @@
169
* Begin "underline" (hopefully real underlining,
170
* otherwise whatever the terminal provides).
171
*/
172
-ul_enter()
173
+void ul_enter(void)
174
{
175
tputs(sc_u_in, 1, putchr);
176
mode_flags |= M_UL;
177
@@ -584,7 +582,7 @@
178
/*
179
* End "underline".
180
*/
181
-ul_exit()
182
+void ul_exit(void)
183
{
184
tputs(sc_u_out, 1, putchr);
185
mode_flags &= ~M_UL;
186
@@ -593,7 +591,7 @@
187
/*
188
* Begin "bold"
189
*/
190
-bo_enter()
191
+void bo_enter(void)
192
{
193
tputs(sc_b_in, 1, putchr);
194
mode_flags |= M_BO;
195
@@ -602,7 +600,7 @@
196
/*
197
* End "bold".
198
*/
199
-bo_exit()
200
+void bo_exit(void)
201
{
202
tputs(sc_b_out, 1, putchr);
203
mode_flags &= ~M_BO;
204
@@ -612,7 +610,7 @@
205
* Erase the character to the left of the cursor
206
* and move the cursor left.
207
*/
208
-backspace()
209
+void backspace(void)
210
{
211
/*
212
* Try to erase the previous character by overstriking with a space.
213
@@ -625,28 +623,27 @@
214
/*
215
* Output a plain backspace, without erasing the previous char.
216
*/
217
-putbs()
218
+void putbs(void)
219
{
220
tputs(sc_backspace, 1, putchr);
221
}
222
223
-putchr(c)
224
- int c;
225
+int putchr(int c)
226
{
227
if (ob >= &obuf[sizeof(obuf)])
228
flush();
229
*ob++ = c;
230
+ return (c);
231
}
232
233
-putstr(s)
234
- register char *s;
235
+void putstr(register char *s)
236
{
237
while (*s != '\0')
238
putchr(*s++);
239
}
240
241
242
-flush()
243
+void flush(void)
244
{
245
register int n;
246
247
@@ -676,10 +673,7 @@
248
return ((unsigned char)c);
249
}
250
251
-iread(fd, buf, len)
252
- int fd;
253
- char *buf;
254
- int len;
255
+int iread(int fd, char *buf, int len)
256
{
257
register int n;
258
259
260