aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/b2m.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/b2m.c')
-rw-r--r--lib-src/b2m.c32
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
67extern char *strtok(); 67extern char *strtok(char *, const char *);
68 68
69long *xmalloc (), *xrealloc (); 69long *xmalloc (unsigned int size);
70char *concat (); 70long *xrealloc (char *ptr, unsigned int size);
71long readline (); 71char *concat (char *s1, char *s2, char *s3);
72void fatal (); 72long readline (struct linebuffer *linebuffer, register FILE *stream);
73void 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[] =
90extern int optind; 91extern int optind;
91 92
92int 93int
93main (argc, argv) 94main (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 */
221char * 220char *
222concat (s1, s2, s3) 221concat (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 */
241long 239long
242readline (linebuffer, stream) 240readline (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 */
293long * 289long *
294xmalloc (size) 290xmalloc (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
303long * 298long *
304xrealloc (ptr, size) 299xrealloc (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
314void 307void
315fatal (message) 308fatal (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);