Merge from Lite2 (reject widths <= 0 instead of pretending that they are 80).

This commit is contained in:
bde 1997-07-06 03:39:37 +00:00
parent c51869ac71
commit 5deeab0f5c

View File

@ -38,7 +38,7 @@ static char copyright[] =
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)banner.c 8.3 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95";
#endif /* not lint */ #endif /* not lint */
/* /*
@ -1026,26 +1026,26 @@ int width = DWIDTH; /* -w option: scrunch letters to 80 columns */
int int
main(argc, argv) main(argc, argv)
int argc; int argc;
char **argv; char *argv[];
{ {
int ch; int ch;
while ((ch = getopt(argc, argv, "w:td")) != -1) while ((ch = getopt(argc, argv, "w:td")) != -1)
switch(ch) { switch (ch) {
case 'w':
width = atoi(optarg);
if (width <= 0)
width = 80;
break;
case 'd': case 'd':
debug = 1; debug = 1;
break; break;
case 't': case 't':
trace = 1; trace = 1;
break; break;
case 'w':
width = atoi(optarg);
if (width <= 0)
errx(1, "illegal argument for -w option");
break;
case '?': case '?':
default: default:
fprintf(stderr, "usage: banner [-w width]\n"); (void)fprintf(stderr, "usage: banner [-w width]\n");
exit(1); exit(1);
} }
argc -= optind; argc -= optind;