diff options
author | charnier <charnier@FreeBSD.org> | 2000-07-24 20:22:49 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 2000-07-24 20:22:49 +0000 |
commit | 75e5dfa3fc08288e085341d70369e2de188e7bf6 (patch) | |
tree | dd12372cb0080de6a7bd65b0bb5eccbf5608a5a5 /usr.bin/colcrt/colcrt.c | |
parent | 281c0600008e1556b00bbdeb1bb085bb755e3a98 (diff) | |
download | FreeBSD-src-75e5dfa3fc08288e085341d70369e2de188e7bf6.zip FreeBSD-src-75e5dfa3fc08288e085341d70369e2de188e7bf6.tar.gz |
Start enumerate option with `The following options are available' like
most of the utilities.
.Nm prog -> .Nm
Remove unused include
Make use of getopt() instead of parsing params by hand.
Diffstat (limited to 'usr.bin/colcrt/colcrt.c')
-rw-r--r-- | usr.bin/colcrt/colcrt.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/usr.bin/colcrt/colcrt.c b/usr.bin/colcrt/colcrt.c index 67f4b06..4b5b525 100644 --- a/usr.bin/colcrt/colcrt.c +++ b/usr.bin/colcrt/colcrt.c @@ -46,7 +46,6 @@ static const char rcsid[] = #endif /* not lint */ #include <err.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -86,23 +85,22 @@ main(argc, argv) { int c; char *cp, *dp; + int ch; - argc--; - argv++; - while (argc > 0 && argv[0][0] == '-') { - switch (argv[0][1]) { - case 0: - suppresul = 1; - break; - case '2': - printall = 1; - break; - default: - usage(); + while ((ch = getopt(argc, argv, "-2")) != -1) + switch (ch) { + case '-': + suppresul = 1; + break; + case '2': + printall = 1; + break; + default: + usage(); } - argc--; - argv++; - } + argc -= optind; + argv += optind; + do { if (argc > 0) { close(0); @@ -193,7 +191,7 @@ main(argc, argv) static void usage() { - fprintf(stderr, "usage: colcrt [ - ] [ -2 ] [ file ... ]\n"); + fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n"); exit(1); } |