SCCS-vsn: usr.bin/wc/wc.c 4.2
-static char *sccsid = "@(#)wc.c 4.1 (Berkeley) %G%";
+static char *sccsid = "@(#)wc.c 4.2 (Berkeley) %G%";
/* wc line and word count */
#include <stdio.h>
/* wc line and word count */
#include <stdio.h>
wd = argv[1]+1;
break;
case 's':
wd = argv[1]+1;
break;
case 's':
+ if (argc == 2)
+ goto usage;
+ if (lpp <= 0)
+ goto usage;
break;
case 'v':
verbose++;
break;
case 'v':
verbose++;
+ if (argc == 2)
+ goto usage;
baud = atoi(argv[1]+2);
if (baud == 110)
cps = 10;
else
cps = baud / 10;
baud = atoi(argv[1]+2);
if (baud == 110)
cps = 10;
else
cps = baud / 10;
+ if (cps <= 0)
+ goto usage;
+ default:
+ usage:
+ fprintf(stderr, "Usage: wc [-lwcpt] [-v] [-u] [-s pagesize] [-b baudrate]\n");
+ exit(1);