1 |
+ |
/* $MidnightBSD$ */ |
2 |
|
/*- |
3 |
|
* Copyright (c) 1999 The NetBSD Foundation, Inc. |
4 |
|
* All rights reserved. |
33 |
|
__COPYRIGHT( |
34 |
|
"@(#) Copyright (c) 1999\ |
35 |
|
The NetBSD Foundation, Inc. All rights reserved."); |
36 |
< |
__RCSID("$MidnightBSD$"); |
36 |
> |
__RCSID("$FreeBSD: stable/10/usr.bin/nl/nl.c 226362 2011-10-14 07:28:39Z ed $"); |
37 |
|
#endif |
38 |
|
|
39 |
|
#define _WITH_GETLINE |
74 |
|
#define NP_LAST HEADER |
75 |
|
|
76 |
|
static struct numbering_property numbering_properties[NP_LAST + 1] = { |
77 |
< |
{ "footer", number_none }, |
78 |
< |
{ "body", number_nonempty }, |
79 |
< |
{ "header", number_none } |
77 |
> |
{ .name = "footer", .type = number_none }, |
78 |
> |
{ .name = "body", .type = number_nonempty }, |
79 |
> |
{ .name = "header", .type = number_none } |
80 |
|
}; |
81 |
|
|
82 |
|
#define max(a, b) ((a) > (b) ? (a) : (b)) |
129 |
|
|
130 |
|
|
131 |
|
int |
132 |
< |
main(argc, argv) |
132 |
< |
int argc; |
133 |
< |
char *argv[]; |
132 |
> |
main(int argc, char *argv[]) |
133 |
|
{ |
134 |
|
int c; |
135 |
|
long val; |
257 |
|
delimlen = delim1len + delim2len; |
258 |
|
|
259 |
|
/* Allocate a buffer suitable for preformatting line number. */ |
260 |
< |
intbuffersize = max(INT_STRLEN_MAXIMUM, width) + 1; /* NUL */ |
260 |
> |
intbuffersize = max((int)INT_STRLEN_MAXIMUM, width) + 1; /* NUL */ |
261 |
|
if ((intbuffer = malloc(intbuffersize)) == NULL) |
262 |
|
err(EXIT_FAILURE, "cannot allocate preformatting buffer"); |
263 |
|
|
269 |
|
} |
270 |
|
|
271 |
|
static void |
272 |
< |
filter() |
272 |
> |
filter(void) |
273 |
|
{ |
274 |
|
char *buffer; |
275 |
|
size_t buffersize; |
358 |
|
*/ |
359 |
|
|
360 |
|
static void |
361 |
< |
parse_numbering(argstr, section) |
363 |
< |
const char *argstr; |
364 |
< |
int section; |
361 |
> |
parse_numbering(const char *argstr, int section) |
362 |
|
{ |
363 |
|
int error; |
364 |
|
char errorbuf[NL_TEXTMAX]; |
400 |
|
} |
401 |
|
|
402 |
|
static void |
403 |
< |
usage() |
403 |
> |
usage(void) |
404 |
|
{ |
405 |
|
|
406 |
|
(void)fprintf(stderr, |