Use errx(), remove unused #include. Correct SYNOPSIS
This commit is contained in:
parent
3bd17b58bc
commit
a2995dd0f1
@ -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 .
|
||||
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user