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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
$NetBSD: patch-ex__temp_c,v 1.1 2012/12/28 03:03:08 dholland Exp $
- declare local functions static
- declare void functions void
- avoid implicit int
- silence warnings about assignments in conditionals
- silence signed/unsigned compiler warning
- return values from non-void functions
--- ex_temp.c~ 2012-12-27 21:58:41.000000000 +0000
+++ ex_temp.c
@@ -106,11 +106,14 @@ int havetmp;
int tfile = -1;
int rfile = -1;
-int YANKline __P((void));
-int rbflush __P((void));
-int blkio __P((bloc, char *, ssize_t (*) __P((int, void *, size_t))));
-char *getblock __P((line, int));
+static void YANKline __P((void));
+static void rbflush __P((void));
+static void blkio __P((bloc, char *, ssize_t (*) __P((int, void *, size_t))));
+static char *getblock __P((line, int));
+static ssize_t shread __P((void));
+static int getREG __P((void));
+void
fileinit()
{
register char *p;
@@ -196,6 +199,7 @@ dumbness:
/* brk((char *)fendcore); */
}
+void
cleanup(all)
bool all;
{
@@ -213,6 +217,7 @@ cleanup(all)
}
}
+void
get_line(tl)
line tl;
{
@@ -223,13 +228,14 @@ get_line(tl)
bp = getblock(tl, READ);
nl = nleft;
tl &= ~OFFMSK;
- while (*lp++ = *bp++)
+ while ((*lp++ = *bp++) != 0)
if (--nl == 0) {
bp = getblock(tl += INCRMT, READ);
nl = nleft;
}
}
+int
putline()
{
register char *bp, *lp;
@@ -243,7 +249,7 @@ putline()
bp = getblock(tl, WRITE);
nl = nleft;
tl &= ~OFFMSK;
- while (*bp = *lp++) {
+ while ((*bp = *lp++) != 0) {
if (*bp++ == '\n') {
*--bp = 0;
linebp = lp;
@@ -264,7 +270,7 @@ ssize_t read __P((int, void *, size_t));
ssize_t write __P((int, void *, size_t));
#endif
-char *
+static char *
getblock(atl, iof)
line atl;
int iof;
@@ -321,8 +327,8 @@ char incorb[INCORB+1][BUFSIZ];
bloc stilinc; /* up to here not written yet */
#endif
+static void
#ifdef __STDC__
-int
blkio(bloc b, char *buf, ssize_t (*iofcn)(int, void *, size_t))
#else /* !__STDC__ */
blkio(b, buf, iofcn)
@@ -353,6 +359,7 @@ blkio(b, buf, iofcn)
}
#ifdef INCORB
+void
tlaste()
{
@@ -360,6 +367,7 @@ tlaste()
dirtcnt = 0;
}
+void
tflush()
{
bbloc i = stilinc;
@@ -375,6 +383,7 @@ tflush()
* Synchronize the state of the temporary file in case
* a crash occurs.
*/
+void
synctmp()
{
register bbloc cnt;
@@ -438,6 +447,7 @@ oops:
#endif
}
+void
TSYNC()
{
@@ -493,6 +503,7 @@ short rblock;
short rnext;
char *rbufcp;
+static void
regio(b, iofcn)
short b;
ssize_t (*iofcn) __P((int, void *, size_t));
@@ -542,11 +553,12 @@ oops:
rblock = b;
}
+static int
REGblk()
{
register int i, j, m;
- for (i = 0; i < sizeof rused / sizeof rused[0]; i++) {
+ for (i = 0; i < (int)(sizeof rused / sizeof rused[0]); i++) {
m = (rused[i] ^ 0177777) & 0177777;
if (i == 0)
m &= ~1;
@@ -562,10 +574,11 @@ REGblk()
}
}
error(catgets(catd, 1, 186, "Out of register space (ugh)"));
- /*NOTREACHED*/
+ /* XXX what do we do here? */
+ return 0;
}
-struct strreg *
+static struct strreg *
mapreg(c)
register int c;
{
@@ -575,8 +588,7 @@ mapreg(c)
return (isdigit(c) ? &strregs[('z'-'a'+1)+(c-'0')] : &strregs[c-'a']);
}
-ssize_t shread();
-
+static void
KILLreg(c)
register int c;
{
@@ -598,8 +610,8 @@ KILLreg(c)
}
/*VARARGS*/
-ssize_t
-shread()
+static ssize_t
+shread(void)
{
struct front { short a; short b; };
@@ -608,9 +620,8 @@ shread()
return (0);
}
-int getREG();
-
-putreg(c)
+void
+putreg(int c)
{
register line *odot = dot;
register line *odol = dol;
@@ -651,12 +662,14 @@ putreg(c)
notecnt = cnt;
}
-partreg(c)
+int
+partreg(int c)
{
return (mapreg(c)->rg_flags);
}
+void
notpart(c)
register int c;
{
@@ -665,6 +678,7 @@ notpart(c)
mapreg(c)->rg_flags = 0;
}
+static int
getREG()
{
register char *lp = linebuf;
@@ -691,6 +705,7 @@ getREG()
}
}
+void
YANKreg(c)
register int c;
{
@@ -729,6 +744,7 @@ YANKreg(c)
CP(linebuf,savelb);
}
+void
kshift()
{
register int i;
@@ -738,6 +754,7 @@ kshift()
copy(mapreg(i+1), mapreg(i), sizeof (struct strreg));
}
+static void
YANKline()
{
register char *lp = linebuf;
@@ -764,6 +781,7 @@ YANKline()
*rbufcp = 0;
}
+static void
rbflush()
{
register struct strreg *sp = strp;
@@ -778,6 +796,7 @@ rbflush()
}
/* Register c to char buffer buf of size buflen */
+void
regbuf(c, buf, buflen)
char c;
char *buf;
|