diff options
author | Hidetoshi Shimokawa <simokawa@FreeBSD.org> | 1999-01-18 06:59:18 +0000 |
---|---|---|
committer | Hidetoshi Shimokawa <simokawa@FreeBSD.org> | 1999-01-18 06:59:18 +0000 |
commit | 3ba3e2cc4b63fa16707f51e735e751e62dd9526e (patch) | |
tree | 2d073c94248fff7dcaa8a3b1356933e1dcd784db /contrib/global/lib/test.c | |
parent | 0823b5bf088ea8520ea23a0c424e4ecab62491d5 (diff) |
Notes
Diffstat (limited to 'contrib/global/lib/test.c')
-rw-r--r-- | contrib/global/lib/test.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/global/lib/test.c b/contrib/global/lib/test.c index a3b5966e26a4..d5c940ea294c 100644 --- a/contrib/global/lib/test.c +++ b/contrib/global/lib/test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. + * Copyright (c) 1996, 1997, 1998 Shigio Yamaguchi. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,8 +31,8 @@ * test.c 12-Dec-97 * */ -#include <sys/stat.h> #include <sys/types.h> +#include <sys/stat.h> #include <unistd.h> @@ -50,21 +50,23 @@ * "x" [ -x path ] * * i) path path + * if NULL then previous path. * r) 0: no, 1: ok * * You can specify more than one character. It assumed 'and' test. */ int test(flags, path) -char *flags; -char *path; +const char *flags; +const char *path; { - struct stat sb; + static struct stat sb; int c; - if (stat(path, &sb) < 0) - return 0; - while ((c = *flags++) != NULL) { + if (path != NULL) + if (stat(path, &sb) < 0) + return 0; + while ((c = *flags++) != 0) { switch (c) { case 'f': if (!S_ISREG(sb.st_mode)) |