diff options
Diffstat (limited to 'lib-src/b2m.c')
| -rw-r--r-- | lib-src/b2m.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/lib-src/b2m.c b/lib-src/b2m.c index 7de48e6a522..733cd276653 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c | |||
| @@ -64,12 +64,13 @@ struct linebuffer | |||
| 64 | char *buffer; | 64 | char *buffer; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | extern char *strtok(); | 67 | extern char *strtok(char *, const char *); |
| 68 | 68 | ||
| 69 | long *xmalloc (), *xrealloc (); | 69 | long *xmalloc (unsigned int size); |
| 70 | char *concat (); | 70 | long *xrealloc (char *ptr, unsigned int size); |
| 71 | long readline (); | 71 | char *concat (char *s1, char *s2, char *s3); |
| 72 | void fatal (); | 72 | long readline (struct linebuffer *linebuffer, register FILE *stream); |
| 73 | void fatal (char *message); | ||
| 73 | 74 | ||
| 74 | /* | 75 | /* |
| 75 | * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); | 76 | * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); |
| @@ -90,9 +91,7 @@ struct option longopts[] = | |||
| 90 | extern int optind; | 91 | extern int optind; |
| 91 | 92 | ||
| 92 | int | 93 | int |
| 93 | main (argc, argv) | 94 | main (int argc, char **argv) |
| 94 | int argc; | ||
| 95 | char **argv; | ||
| 96 | { | 95 | { |
| 97 | logical labels_saved, printing, header, first, last_was_blank_line; | 96 | logical labels_saved, printing, header, first, last_was_blank_line; |
| 98 | time_t ltoday; | 97 | time_t ltoday; |
| @@ -219,8 +218,7 @@ main (argc, argv) | |||
| 219 | * concatenate those of s1, s2, s3. | 218 | * concatenate those of s1, s2, s3. |
| 220 | */ | 219 | */ |
| 221 | char * | 220 | char * |
| 222 | concat (s1, s2, s3) | 221 | concat (char *s1, char *s2, char *s3) |
| 223 | char *s1, *s2, *s3; | ||
| 224 | { | 222 | { |
| 225 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | 223 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); |
| 226 | char *result = xnew (len1 + len2 + len3 + 1, char); | 224 | char *result = xnew (len1 + len2 + len3 + 1, char); |
| @@ -239,9 +237,7 @@ concat (s1, s2, s3) | |||
| 239 | * which is the length of the line including the newline, if any. | 237 | * which is the length of the line including the newline, if any. |
| 240 | */ | 238 | */ |
| 241 | long | 239 | long |
| 242 | readline (linebuffer, stream) | 240 | readline (struct linebuffer *linebuffer, register FILE *stream) |
| 243 | struct linebuffer *linebuffer; | ||
| 244 | register FILE *stream; | ||
| 245 | { | 241 | { |
| 246 | char *buffer = linebuffer->buffer; | 242 | char *buffer = linebuffer->buffer; |
| 247 | register char *p = linebuffer->buffer; | 243 | register char *p = linebuffer->buffer; |
| @@ -291,8 +287,7 @@ readline (linebuffer, stream) | |||
| 291 | * Like malloc but get fatal error if memory is exhausted. | 287 | * Like malloc but get fatal error if memory is exhausted. |
| 292 | */ | 288 | */ |
| 293 | long * | 289 | long * |
| 294 | xmalloc (size) | 290 | xmalloc (unsigned int size) |
| 295 | unsigned int size; | ||
| 296 | { | 291 | { |
| 297 | long *result = (long *) malloc (size); | 292 | long *result = (long *) malloc (size); |
| 298 | if (result == NULL) | 293 | if (result == NULL) |
| @@ -301,9 +296,7 @@ xmalloc (size) | |||
| 301 | } | 296 | } |
| 302 | 297 | ||
| 303 | long * | 298 | long * |
| 304 | xrealloc (ptr, size) | 299 | xrealloc (char *ptr, unsigned int size) |
| 305 | char *ptr; | ||
| 306 | unsigned int size; | ||
| 307 | { | 300 | { |
| 308 | long *result = (long *) realloc (ptr, size); | 301 | long *result = (long *) realloc (ptr, size); |
| 309 | if (result == NULL) | 302 | if (result == NULL) |
| @@ -312,8 +305,7 @@ xrealloc (ptr, size) | |||
| 312 | } | 305 | } |
| 313 | 306 | ||
| 314 | void | 307 | void |
| 315 | fatal (message) | 308 | fatal (char *message) |
| 316 | char *message; | ||
| 317 | { | 309 | { |
| 318 | fprintf (stderr, "%s: %s\n", progname, message); | 310 | fprintf (stderr, "%s: %s\n", progname, message); |
| 319 | exit (EXIT_FAILURE); | 311 | exit (EXIT_FAILURE); |