summaryrefslogtreecommitdiffstats
path: root/bin/test
diff options
context:
space:
mode:
authorknu <knu@FreeBSD.org>2001-11-19 20:39:24 +0000
committerknu <knu@FreeBSD.org>2001-11-19 20:39:24 +0000
commit9a58963b18cf4de7d8376c9d35ed5241d9c676ab (patch)
tree364a021b40390f4e356b5e65bc490fe5b4119b2d /bin/test
parent4531e87e8cad1770e6a8ac6e8c191d92e60ab1a9 (diff)
downloadFreeBSD-src-9a58963b18cf4de7d8376c9d35ed5241d9c676ab.zip
FreeBSD-src-9a58963b18cf4de7d8376c9d35ed5241d9c676ab.tar.gz
Fix style bugs I found, and add a comment.
Diffstat (limited to 'bin/test')
-rw-r--r--bin/test/test.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/bin/test/test.c b/bin/test/test.c
index 8007a47..1637c0d 100644
--- a/bin/test/test.c
+++ b/bin/test/test.c
@@ -204,18 +204,19 @@ main(argc, argv)
else
p++;
if (strcmp(p, "[") == 0) {
- if (strcmp(argv[--argc], "]"))
+ if (strcmp(argv[--argc], "]") != 0)
error("missing ]");
argv[argc] = NULL;
}
+ /* no expression => false */
+ if (--argc <= 0)
+ return 1;
+
/* XXX work around the absence of an eaccess(2) syscall */
(void)setgid(getegid());
(void)setuid(geteuid());
- if (--argc <= 0)
- return 1;
-
t_wp = &argv[1];
res = !oexpr(t_lex(*t_wp));
@@ -469,13 +470,13 @@ getn(s)
r = strtol(s, &p, 10);
if (errno != 0)
- error("%s: out of range", s);
+ error("%s: out of range", s);
while (isspace((unsigned char)*p))
- p++;
+ p++;
if (*p)
- error("%s: bad number", s);
+ error("%s: bad number", s);
return (int) r;
}
@@ -492,13 +493,13 @@ getq(s)
r = strtoq(s, &p, 10);
if (errno != 0)
- error("%s: out of range", s);
+ error("%s: out of range", s);
while (isspace((unsigned char)*p))
- p++;
+ p++;
if (*p)
- error("%s: bad number", s);
+ error("%s: bad number", s);
return r;
}
OpenPOWER on IntegriCloud