From 26ea86f226645220e1d19a2188b311adfcba314a Mon Sep 17 00:00:00 2001 From: charnier Date: Sun, 26 Mar 2000 14:28:31 +0000 Subject: Use errx(), remove unused #include. Correct SYNOPSIS --- usr.bin/expand/expand.1 | 10 +++++----- usr.bin/expand/expand.c | 24 +++++++++--------------- 2 files changed, 14 insertions(+), 20 deletions(-) (limited to 'usr.bin/expand') diff --git a/usr.bin/expand/expand.1 b/usr.bin/expand/expand.1 index 6c4aebc..269f18f 100644 --- a/usr.bin/expand/expand.1 +++ b/usr.bin/expand/expand.1 @@ -42,11 +42,11 @@ .Sh SYNOPSIS .Nm expand .Op Fl Ns Ar tabstop -.Op Fl Ns Ar tab1,tab2,...,tabn -.Ar +.Op Fl t Ar tab1,tab2,...,tabn +.Op Ar .Nm unexpand .Op Fl a -.Ar +.Op Ar .Sh DESCRIPTION .Nm Expand processes the named files or the standard input writing @@ -73,7 +73,7 @@ files and writes the result on the standard output. Option (with .Nm unexpand only): -.Bl -tag -width flag +.Bl -tag -width indent .It Fl a By default, only leading blanks and tabs are reconverted to maximal strings of tabs. If the @@ -83,6 +83,6 @@ resultant file by replacing two or more characters. .El .Sh HISTORY The -.Nm expand +.Nm command appeared in .Bx 3.0 . diff --git a/usr.bin/expand/expand.c b/usr.bin/expand/expand.c index f16f645..fcc7230 100644 --- a/usr.bin/expand/expand.c +++ b/usr.bin/expand/expand.c @@ -40,15 +40,14 @@ static const char copyright[] = #ifndef lint #if 0 static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93"; -#else -static const char rcsid[] = - "$FreeBSD$"; #endif +static const char rcsid[] = + "$FreeBSD$"; #endif /* not lint */ #include +#include #include -#include #include /* @@ -90,10 +89,8 @@ main(argc, argv) do { if (argc > 0) { - if (freopen(argv[0], "r", stdin) == NULL) { - perror(argv[0]); - exit(1); - } + if (freopen(argv[0], "r", stdin) == NULL) + errx(1, "%s", argv[0]); argc--, argv++; } column = 0; @@ -160,18 +157,15 @@ getstops(cp) i = 0; while (*cp >= '0' && *cp <= '9') i = i * 10 + *cp++ - '0'; - if (i <= 0 || i > 256) { -bad: - fprintf(stderr, "Bad tab stop spec\n"); - exit(1); - } + if (i <= 0 || i > 256) + errx(1, "bad tab stop spec"); if (nstops > 0 && i <= tabstops[nstops-1]) - goto bad; + errx(1, "bad tab stop spec"); tabstops[nstops++] = i; if (*cp == 0) break; if (*cp != ',' && *cp != ' ') - goto bad; + errx(1, "bad tab stop spec"); cp++; } } -- cgit v1.1