projects/aports·blob master · refs

508 lines · 13.3 KiB

1diff --git a/ar/ar.c b/ar/ar.c
2index f808a3a..fce2ab7 100644
3--- a/ar/ar.c
4+++ b/ar/ar.c
5@@ -612,7 +612,7 @@ print_descr (member, instream)
6 return;
7 }
8 print_modes (member.mode);
9- timestring = ctime (&member.date);
10+ timestring = ctime ((const time_t *)&member.date);
11 printf (" %2d/%2d %6d %12.12s %4.4s %s\n",
12 member.uid, member.gid,
13 member.size, timestring + 4, timestring + 20,
14diff --git a/bcc/dbprintf.c b/bcc/dbprintf.c
15index a77a012..bc0b498 100644
16--- a/bcc/dbprintf.c
17+++ b/bcc/dbprintf.c
18@@ -1,6 +1,8 @@
19
20 #include <sys/types.h>
21 #include <fcntl.h>
22+#include <unistd.h>
23+#include <string.h>
24
25 #if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__)
26 #include <stdarg.h>
27@@ -10,6 +12,8 @@
28 #define va_strt(p,i) va_start(p)
29 #endif
30
31+int vdbprintf(register __const char *fmt, register va_list ap);
32+
33 #if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__)
34 int dbprintf(const char * fmt, ...)
35 #else
36diff --git a/cpp/cpp.c b/cpp/cpp.c
37index a6e7337..1ca4422 100644
38--- a/cpp/cpp.c
39+++ b/cpp/cpp.c
40@@ -545,7 +545,7 @@ chget()
41 }
42
43 static void
44-unchget(ch)
45+unchget(int ch)
46 {
47 #if CPP_DEBUG
48 fprintf(stderr, "\b", ch);
49diff --git a/ld/catimage.c b/ld/catimage.c
50index 1f5e160..6e726a6 100644
51--- a/ld/catimage.c
52+++ b/ld/catimage.c
53@@ -27,6 +27,15 @@
54 #endif
55 #include "x86_aout.h"
56
57+#include <string.h>
58+
59+void fatal(char * str);
60+void open_obj(char * fname);
61+void copy_segment(long out_offset, long in_offset, long length);
62+void patch_bin(long file_off, int value);
63+void read_symtable();
64+void fatal(char * str);
65+
66 #ifndef __OUT_OK
67 #error "Compile error: struct exec invalid (long not 32 bit ?)"
68 #endif
69@@ -39,7 +48,7 @@ FILE * ofd;
70 FILE * ifd = 0;
71 struct exec header;
72
73-main(argc, argv)
74+void main(argc, argv)
75 int argc;
76 char ** argv;
77 {
78@@ -100,7 +109,7 @@ char ** argv;
79 exit(0);
80 }
81
82-open_obj(fname)
83+void open_obj(fname)
84 char * fname;
85 {
86 input_file = fname;
87@@ -117,7 +126,7 @@ char * fname;
88 fatal("Input file has bad magic number");
89 }
90
91-copy_segment(out_offset, in_offset, length)
92+void copy_segment(out_offset, in_offset, length)
93 long out_offset, in_offset, length;
94 {
95 char buffer[1024];
96@@ -143,7 +152,7 @@ long out_offset, in_offset, length;
97 }
98 }
99
100-patch_bin(file_off, value)
101+void patch_bin(file_off, value)
102 long file_off;
103 int value;
104 {
105@@ -163,7 +172,7 @@ int value;
106 }
107 }
108
109-read_symtable()
110+void read_symtable()
111 {
112 struct nlist item;
113 int nitems;
114@@ -234,7 +243,7 @@ read_symtable()
115 }
116 }
117
118-fatal(str)
119+void fatal(str)
120 char * str;
121 {
122 fprintf(stderr, "catimage:%s: %s\n", input_file, str);
123diff --git a/ld/objchop.c b/ld/objchop.c
124index c7631c1..7d09619 100644
125--- a/ld/objchop.c
126+++ b/ld/objchop.c
127@@ -6,9 +6,12 @@
128 #endif
129 #include "x86_aout.h"
130
131+void fatal(char * str);
132+void write_file(char * fname, long bsize);
133+
134 #ifndef __OUT_OK
135
136-main()
137+void main()
138 {
139 fprintf(stderr, "Compile error: struct exec invalid\n");
140 exit(1);
141@@ -19,7 +22,7 @@ main()
142 FILE * ifd;
143 struct exec header;
144
145-main(argc, argv)
146+void main(argc, argv)
147 int argc;
148 char ** argv;
149 {
150@@ -56,7 +59,7 @@ char ** argv;
151 exit(0);
152 }
153
154-write_file(fname, bsize)
155+void write_file(fname, bsize)
156 char * fname;
157 long bsize;
158 {
159@@ -81,7 +84,7 @@ long bsize;
160 fclose(ofd);
161 }
162
163-fatal(str)
164+void fatal(str)
165 char * str;
166 {
167 fprintf(stderr, "objchop: %s\n", str);
168diff --git a/unproto/error.c b/unproto/error.c
169index 667d978..1f42a06 100644
170--- a/unproto/error.c
171+++ b/unproto/error.c
172@@ -52,8 +52,7 @@ static char error_sccsid[] = "@(#) error.c 1.2 92/01/15 21:53:10";
173 /* C library */
174
175 #include <stdio.h>
176-
177-extern void exit();
178+#include <stdlib.h>
179
180 /* Application-specific stuff */
181
182diff --git a/unproto/error.h b/unproto/error.h
183index dfb27e9..cb52ae6 100644
184--- a/unproto/error.h
185+++ b/unproto/error.h
186@@ -1,6 +1,6 @@
187 /* @(#) error.h 1.2 92/01/15 21:53:14 */
188
189 extern int errcount; /* error counter */
190-extern void error(); /* default context */
191-extern void error_where(); /* user-specified context */
192-extern void fatal(); /* fatal error */
193+extern void error(char *text); /* default context */
194+extern void error_where(char *path, int line, char *text); /* user-specified context */
195+extern void fatal(char *text); /* fatal error */
196diff --git a/unproto/strsave.c b/unproto/strsave.c
197index c2a4b15..fc97801 100644
198--- a/unproto/strsave.c
199+++ b/unproto/strsave.c
200@@ -26,11 +26,13 @@ static char strsave_sccsid[] = "@(#) strsave.c 1.1 92/01/15 21:53:13";
201
202 /* C library */
203
204-extern char *strcpy();
205-extern char *malloc();
206+#include <string.h>
207+#include <stdlib.h>
208+#include <sys/types.h>
209
210 /* Application-specific stuff */
211
212+int hash(char *s, unsigned size);
213 #include "error.h"
214
215 #define STR_TABSIZE 100
216diff --git a/unproto/symbol.c b/unproto/symbol.c
217index ce9f7d9..9e1329e 100644
218--- a/unproto/symbol.c
219+++ b/unproto/symbol.c
220@@ -42,11 +42,13 @@ static char symbol_sccsid[] = "@(#) symbol.c 1.4 92/02/15 18:59:56";
221
222 /* C library */
223
224-extern char *strcpy();
225-extern char *malloc();
226+#include <string.h>
227+#include <stdlib.h>
228+#include <sys/types.h>
229
230 /* Application-specific stuff */
231
232+int hash(char *s, unsigned size);
233 #include "error.h"
234 #include "token.h"
235 #include "symbol.h"
236diff --git a/unproto/symbol.h b/unproto/symbol.h
237index 0711c1f..0e2b1d8 100644
238--- a/unproto/symbol.h
239+++ b/unproto/symbol.h
240@@ -6,6 +6,6 @@ struct symbol {
241 struct symbol *next;
242 };
243
244-extern void sym_enter(); /* add symbol to table */
245-extern struct symbol *sym_find(); /* locate symbol */
246+extern void sym_enter(char *name, int type); /* add symbol to table */
247+extern struct symbol *sym_find(register char *name); /* locate symbol */
248 extern void sym_init(); /* prime the table */
249diff --git a/unproto/tok_class.c b/unproto/tok_class.c
250index 38ccd0d..06aaff5 100644
251--- a/unproto/tok_class.c
252+++ b/unproto/tok_class.c
253@@ -49,10 +49,8 @@ static char class_sccsid[] = "@(#) tok_class.c 1.4 92/01/15 21:53:02";
254 /* C library */
255
256 #include <stdio.h>
257-
258-extern char *strcpy();
259-extern long time();
260-extern char *ctime();
261+#include <string.h>
262+#include <time.h>
263
264 /* Application-specific stuff */
265
266@@ -61,16 +59,16 @@ extern char *ctime();
267 #include "token.h"
268 #include "symbol.h"
269
270-static struct token *tok_list();
271-static void tok_list_struct();
272-static void tok_list_append();
273-static void tok_strcat();
274-static void tok_time();
275-static void tok_date();
276-static void tok_space_append();
277+static struct token *tok_list(struct token *t);
278+static void tok_list_struct(register struct token *list, register struct token *t);
279+static void tok_list_append(struct token *h, struct token *t);
280+static void tok_strcat(register struct token *t1);
281+static void tok_time(struct token *t);
282+static void tok_date(struct token *t);
283+static void tok_space_append(register struct token *list, register struct token *t);
284
285 #if defined(MAP_VOID_STAR) || defined(MAP_VOID)
286-static void tok_void(); /* rewrite void keyword */
287+static void tok_void(register struct token *t); /* rewrite void keyword */
288 #endif
289
290 static struct token *tok_buf = 0; /* token push-back storage */
291diff --git a/unproto/tok_io.c b/unproto/tok_io.c
292index 3cae52e..6347949 100644
293--- a/unproto/tok_io.c
294+++ b/unproto/tok_io.c
295@@ -80,11 +80,8 @@ static char io_sccsid[] = "@(#) tok_io.c 1.3 92/01/15 21:52:59";
296
297 #include <stdio.h>
298 #include <ctype.h>
299-
300-extern char *strchr();
301-extern char *malloc();
302-extern char *realloc();
303-extern char *strcpy();
304+#include <string.h>
305+#include <stdlib.h>
306
307 /* Application-specific stuff */
308
309@@ -92,7 +89,7 @@ extern char *strcpy();
310 #include "vstring.h"
311 #include "error.h"
312
313-extern char *strsave(); /* XXX need include file */
314+extern char *strsave(register char *str); /* XXX need include file */
315
316 /* Stuff to keep track of original source file name and position */
317
318@@ -107,12 +104,12 @@ int last_ch; /* type of last output */
319
320 /* Forward declarations */
321
322-static int read_quoted();
323-static void read_comment();
324+static int read_quoted(register struct vstring *vs, int ch);
325+static void read_comment(register struct vstring *vs);
326 static int backslash_newline();
327-static char *read_hex();
328-static char *read_octal();
329-static void fix_line_control();
330+static char *read_hex(struct vstring *vs, register char *cp);
331+static char *read_octal(register struct vstring *vs, register char *cp, register int c);
332+static void fix_line_control(register char *path, register int line);
333
334 /*
335 * Character input with one level of pushback. The INPUT() macro recursively
336@@ -228,7 +225,7 @@ static int do_control()
337 }
338 out_line = in_line = line; /* synchronize */
339 out_path = in_path = path; /* synchronize */
340- return;
341+ return 0;
342
343 #ifdef IGNORE_DIRECTIVES
344
345@@ -247,7 +244,7 @@ static int do_control()
346 do {
347 tok_free(t);
348 } while (t->tokno != '\n' && (t = tok_get()));
349- return;
350+ return 0;
351 }
352 }
353 }
354@@ -259,12 +256,12 @@ static int do_control()
355 do {
356 tok_flush(t);
357 } while (t->tokno != '\n' && (t = tok_get()));
358- return;
359+ return 0;
360
361 case 0:
362 /* Hit EOF, punt. */
363 put_ch('#');
364- return;
365+ return 0;
366 }
367 }
368 }
369diff --git a/unproto/tok_pool.c b/unproto/tok_pool.c
370index e2ed107..6b1bbfe 100644
371--- a/unproto/tok_pool.c
372+++ b/unproto/tok_pool.c
373@@ -37,7 +37,7 @@ static char pool_sccsid[] = "@(#) tok_pool.c 1.2 92/01/15 21:53:04";
374
375 /* C library */
376
377-extern char *malloc();
378+#include <stdlib.h>
379
380 /* Application-specific stuff */
381
382diff --git a/unproto/token.h b/unproto/token.h
383index bb2f50a..e3752a0 100644
384--- a/unproto/token.h
385+++ b/unproto/token.h
386@@ -27,11 +27,11 @@ struct token {
387 /* Input/output functions and macros */
388
389 extern struct token *tok_get(); /* read next single token */
390-extern void tok_show(); /* display (composite) token */
391+extern void tok_show(register struct token *t); /* display (composite) token */
392 extern struct token *tok_class(); /* classify tokens */
393-extern void tok_unget(); /* stuff token back into input */
394+extern void tok_unget(register struct token *t); /* stuff token back into input */
395 extern void put_nl(); /* print newline character */
396-extern void tok_show_ch(); /* emit single-character token */
397+extern void tok_show_ch(register struct token *t); /* emit single-character token */
398
399 #define tok_flush(t) (tok_show(t), tok_free(t))
400
401@@ -46,7 +46,7 @@ extern void tok_show_ch(); /* emit single-character token */
402 /* Memory management */
403
404 struct token *tok_alloc(); /* allocate token storage */
405-extern void tok_free(); /* re-cycle storage */
406+extern void tok_free(register struct token *t); /* re-cycle storage */
407
408 /* Context */
409
410diff --git a/unproto/unproto.c b/unproto/unproto.c
411index 1f29bff..c5ccd33 100644
412--- a/unproto/unproto.c
413+++ b/unproto/unproto.c
414@@ -138,11 +138,9 @@ static char unproto_sccsid[] = "@(#) unproto.c 1.6 93/06/18 22:29:37";
415 #include <sys/stat.h>
416 #include <stdio.h>
417 #include <errno.h>
418-
419-extern void exit();
420-extern int optind;
421-extern char *optarg;
422-extern int getopt();
423+#include <stdlib.h>
424+#include <unistd.h>
425+#include <string.h>
426
427 /* Application-specific stuff */
428
429@@ -158,16 +156,16 @@ extern int getopt();
430
431 /* Forward declarations. */
432
433-static struct token *dcl_flush();
434-static void block_flush();
435+static struct token *dcl_flush(register struct token *t);
436+static void block_flush(register struct token *t);
437 static void block_dcls();
438-static struct token *show_func_ptr_type();
439-static struct token *show_struct_type();
440-static void show_arg_name();
441-static void show_type();
442-static void pair_flush();
443-static void check_cast();
444-static void show_empty_list();
445+static struct token *show_func_ptr_type(struct token *t1, struct token *t2);
446+static struct token *show_struct_type(register struct token *p);
447+static void show_arg_name(register struct token *s);
448+static void show_type(register struct token *s);
449+static void pair_flush(register struct token *t, register int start, register int stop);
450+static void check_cast(struct token *t);
451+static void show_empty_list(register struct token *t);
452
453 #define check_cast_flush(t) (check_cast(t), tok_free(t))
454
455diff --git a/unproto/vstring.c b/unproto/vstring.c
456index 220bd53..7397f8c 100644
457--- a/unproto/vstring.c
458+++ b/unproto/vstring.c
459@@ -67,8 +67,7 @@ static char vstring_sccsid[] = "@(#) vstring.c 1.3 92/01/15 21:53:06";
460
461 /* C library */
462
463-extern char *malloc();
464-extern char *realloc();
465+#include <stdlib.h>
466
467 /* Application-specific stuff */
468
469diff --git a/unproto/vstring.h b/unproto/vstring.h
470index c2e1f88..c4226f4 100644
471--- a/unproto/vstring.h
472+++ b/unproto/vstring.h
473@@ -5,9 +5,10 @@ struct vstring {
474 char *last; /* last position */
475 };
476
477-extern struct vstring *vs_alloc(); /* initial allocation */
478-extern char *vs_realloc(); /* string extension */
479-extern char *vs_strcpy(); /* copy string */
480+extern struct vstring *vs_alloc(int len); /* initial allocation */
481+extern char *vs_realloc(register struct vstring *vp, char *cp); /* string extension */
482+extern char *vs_strcpy(register struct vstring *vp, register char *dst, register char *src); /* copy string */
483+
484
485 /* macro to add one character to auto-resized string */
486
487diff --git a/unproto/tok_class.c b/unproto/tok_class.c
488index 06aaff5..cb7881c 100644
489--- a/unproto/tok_class.c
490+++ b/unproto/tok_class.c
491@@ -363,7 +363,7 @@ register struct token *t;
492 static void tok_time(t)
493 struct token *t;
494 {
495- long now;
496+ time_t now;
497 char *cp;
498 char buf[BUFSIZ];
499
500@@ -385,7 +385,7 @@ struct token *t;
501 static void tok_date(t)
502 struct token *t;
503 {
504- long now;
505+ time_t now;
506 char *cp;
507 char buf[BUFSIZ];
508