summaryrefslogtreecommitdiff
path: root/usr.bin/lam
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2002-07-01 18:03:30 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2002-07-01 18:03:30 +0000
commitf201bc9c84b0722941b3dfe8ec00297c3cb6fac3 (patch)
tree9cfe131c2e65e1083d8fa62c913af202abf7e1d6 /usr.bin/lam
parent6bd521df93334abcdb934c1afd2bf3c264cde025 (diff)
downloadsrc-test2-f201bc9c84b0722941b3dfe8ec00297c3cb6fac3.tar.gz
src-test2-f201bc9c84b0722941b3dfe8ec00297c3cb6fac3.zip
Notes
Diffstat (limited to 'usr.bin/lam')
-rw-r--r--usr.bin/lam/lam.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c
index 11711538d8d3..9791d38060b7 100644
--- a/usr.bin/lam/lam.c
+++ b/usr.bin/lam/lam.c
@@ -83,12 +83,11 @@ main(int argc, char *argv[])
{
struct openfile *ip;
- if (argc > MAXOFILES)
- errx(1, "too many input files");
- else if (argc == 1)
+ if (argc == 1)
usage();
-
getargs(argv);
+ if (!morefiles)
+ usage();
for (;;) {
linep = line;
for (ip = input; ip->fp != NULL; ip++)
@@ -114,10 +113,11 @@ getargs(char *av[])
P = S = F = T = 0; /* capitalized options */
while ((p = *++av) != NULL) {
if (*p != '-' || !p[1]) {
- morefiles++;
- if (*p == '-') {
+ if (++morefiles >= MAXOFILES)
+ errx(1, "too many input files");
+ if (*p == '-')
ip->fp = stdin;
- } else if ((ip->fp = fopen(p, "r")) == NULL) {
+ else if ((ip->fp = fopen(p, "r")) == NULL) {
err(1, "%s", p);
}
ip->pad = P;