diff options
author | charnier <charnier@FreeBSD.org> | 1997-06-26 11:23:47 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-06-26 11:23:47 +0000 |
commit | 948c4a67c32caa8d0ba4ac0c69ad4b47c4ba237e (patch) | |
tree | effed93b0db41300af0ba5722d5fc7e66086cac7 | |
parent | 6b6d733955d0d116d2fd6b27d39b3e6fb37b486b (diff) | |
download | FreeBSD-src-948c4a67c32caa8d0ba4ac0c69ad4b47c4ba237e.zip FreeBSD-src-948c4a67c32caa8d0ba4ac0c69ad4b47c4ba237e.tar.gz |
Remove use of progname. Add usage().
-rw-r--r-- | usr.bin/colcrt/colcrt.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.bin/colcrt/colcrt.c b/usr.bin/colcrt/colcrt.c index 9e6136b..f3661a8 100644 --- a/usr.bin/colcrt/colcrt.c +++ b/usr.bin/colcrt/colcrt.c @@ -64,9 +64,11 @@ int outcol; char suppresul; char printall; -char *progname; FILE *f; +static void usage __P((void)); + +int main(argc, argv) int argc; char *argv[]; @@ -75,7 +77,7 @@ main(argc, argv) register char *cp, *dp; argc--; - progname = *argv++; + argv++; while (argc > 0 && argv[0][0] == '-') { switch (argv[0][1]) { case 0: @@ -85,9 +87,7 @@ main(argc, argv) printall = 1; break; default: - printf("usage: %s [ - ] [ -2 ] [ file ... ]\n", progname); - fflush(stdout); - exit(1); + usage(); } argc--; argv++; @@ -97,8 +97,7 @@ main(argc, argv) close(0); if (!(f = fopen(argv[0], "r"))) { fflush(stdout); - perror(argv[0]); - exit (1); + err(1, argv[0]); } argc--; argv++; @@ -180,6 +179,13 @@ main(argc, argv) exit(0); } +static void +usage() +{ + fprintf(stderr, "usage: colcrt [ - ] [ -2 ] [ file ... ]\n"); + exit(1); +} + plus(c, d) char c, d; { |