diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-12-28 09:34:57 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-12-28 09:34:57 +0000 |
commit | d7ad2d9d5002e876691058b84b6bf9762950d553 (patch) | |
tree | 60dab4a31d637d5b1c572eefa31a9da7ec3b9c6d /bin/test/test.c | |
parent | 596bec42bc268dd87d5466b6e594fa2a171b031e (diff) | |
download | FreeBSD-src-d7ad2d9d5002e876691058b84b6bf9762950d553.zip FreeBSD-src-d7ad2d9d5002e876691058b84b6bf9762950d553.tar.gz |
Take into account the fact that "[" may be called with a path,
for example "/bin/[".
Reported by: Vlad Skvortsov <vss@ulstu.ru>
Reported by: Peter Jeremy <peter.jeremy@alcatel.com.au>
Message-Id: 99Dec27.111307est.40321@border.alcanet.com.au
Diffstat (limited to 'bin/test/test.c')
-rw-r--r-- | bin/test/test.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/test/test.c b/bin/test/test.c index e02559d..c9df4e3 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -163,8 +163,13 @@ main(argc, argv) char **argv; { int res; + char *p; - if (strcmp(argv[0], "[") == 0) { + if ((p = rindex(argv[0], '/')) == NULL) + p = argv[0]; + else + p++; + if (strcmp(p, "[") == 0) { if (strcmp(argv[--argc], "]")) errx(2, "missing ]"); argv[argc] = NULL; |