diff options
author | charnier <charnier@FreeBSD.org> | 2000-03-26 14:28:31 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 2000-03-26 14:28:31 +0000 |
commit | 26ea86f226645220e1d19a2188b311adfcba314a (patch) | |
tree | a00ceee7dc559295ecc34ffffed9279be5e7e4f2 /usr.bin/expand | |
parent | 9349f009d7736cba72463c747e2c51160db813d6 (diff) | |
download | FreeBSD-src-26ea86f226645220e1d19a2188b311adfcba314a.zip FreeBSD-src-26ea86f226645220e1d19a2188b311adfcba314a.tar.gz |
Use errx(), remove unused #include. Correct SYNOPSIS
Diffstat (limited to 'usr.bin/expand')
-rw-r--r-- | usr.bin/expand/expand.1 | 10 | ||||
-rw-r--r-- | usr.bin/expand/expand.c | 24 |
2 files changed, 14 insertions, 20 deletions
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 <ctype.h> +#include <err.h> #include <stdio.h> -#include <stdlib.h> #include <unistd.h> /* @@ -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++; } } |