Audit wc(1)
Style cleanup, Manpage refactoring.
This commit is contained in:
parent
960bccbe9d
commit
7bacd98b0e
2
README
2
README
@ -86,7 +86,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
|
|||||||
=*| unlink yes none
|
=*| unlink yes none
|
||||||
=*| uudecode yes none
|
=*| uudecode yes none
|
||||||
=*| uuencode yes none
|
=*| uuencode yes none
|
||||||
#* wc yes none
|
#*| wc yes none
|
||||||
= xargs no -I, -L, -p, -s, -t, -x
|
= xargs no -I, -L, -p, -s, -t, -x
|
||||||
=*| yes non-posix none
|
=*| yes non-posix none
|
||||||
|
|
||||||
|
8
wc.1
8
wc.1
@ -1,4 +1,4 @@
|
|||||||
.Dd February 1, 2015
|
.Dd March 18, 2015
|
||||||
.Dt WC 1
|
.Dt WC 1
|
||||||
.Os sbase
|
.Os sbase
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -11,9 +11,9 @@
|
|||||||
.Op Ar file ...
|
.Op Ar file ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
prints the number of lines, words and bytes in each
|
writes the number of lines, words and bytes in each
|
||||||
.Ar file ,
|
.Ar file
|
||||||
unless set differently with flags.
|
to stdout.
|
||||||
If no
|
If no
|
||||||
.Ar file
|
.Ar file
|
||||||
is given
|
is given
|
||||||
|
15
wc.c
15
wc.c
@ -61,7 +61,7 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i;
|
int many;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
@ -81,20 +81,21 @@ main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (!argc) {
|
||||||
wc(stdin, NULL);
|
wc(stdin, NULL);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < argc; i++) {
|
for (many = (argc > 1); *argv; argc--, argv++) {
|
||||||
if (!(fp = fopen(argv[i], "r"))) {
|
if (!(fp = fopen(*argv, "r"))) {
|
||||||
weprintf("fopen %s:", argv[i]);
|
weprintf("fopen %s:", *argv);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
wc(fp, argv[i]);
|
wc(fp, *argv);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
if (argc > 1)
|
if (many)
|
||||||
output("total", tc, tl, tw);
|
output("total", tc, tl, tw);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user