summaryrefslogtreecommitdiffstats
path: root/usr.bin/colcrt
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>2000-07-24 20:22:49 +0000
committercharnier <charnier@FreeBSD.org>2000-07-24 20:22:49 +0000
commit75e5dfa3fc08288e085341d70369e2de188e7bf6 (patch)
treedd12372cb0080de6a7bd65b0bb5eccbf5608a5a5 /usr.bin/colcrt
parent281c0600008e1556b00bbdeb1bb085bb755e3a98 (diff)
downloadFreeBSD-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')
-rw-r--r--usr.bin/colcrt/colcrt.18
-rw-r--r--usr.bin/colcrt/colcrt.c32
2 files changed, 19 insertions, 21 deletions
diff --git a/usr.bin/colcrt/colcrt.1 b/usr.bin/colcrt/colcrt.1
index 1167e46..ba7d70c 100644
--- a/usr.bin/colcrt/colcrt.1
+++ b/usr.bin/colcrt/colcrt.1
@@ -51,8 +51,8 @@ is destructive.
Half-line characters and underlining (changed to dashing `\-')
are placed on new lines in between the normal output lines.
.Pp
-Available options:
-.Bl -tag -width Ds
+The following options are available:
+.Bl -tag -width indent
.It Fl
Suppress all underlining.
This option is especially useful for previewing
@@ -60,7 +60,7 @@ This option is especially useful for previewing
tables from
.Xr tbl 1 .
.It Fl 2
-Causes all half-lines to be printed, effectively double spacing the output.
+Cause all half-lines to be printed, effectively double spacing the output.
Normally, a minimal space output format is used which will suppress empty
lines.
The program never suppresses two consecutive empty lines, however.
@@ -71,7 +71,7 @@ contains superscripts and subscripts which would otherwise be invisible.
.El
.Sh EXAMPLES
A typical use of
-.Nm colcrt
+.Nm
would be
.Bd -literal
tbl exum2.n \&| nroff \-ms \&| colcrt \- \&| more
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);
}
OpenPOWER on IntegriCloud