aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>1999-12-28 09:34:57 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>1999-12-28 09:34:57 +0000
commit9abf30435bf2380a875180dd87b8e7b23aaff9bf (patch)
tree54a150c987e6c3cb4d1ee3b38ee24ddee8b45d5f /bin
parent920eb79f5511ac114d5d133f6c9ff8f7ef52f47c (diff)
downloadsrc-9abf30435bf2380a875180dd87b8e7b23aaff9bf.tar.gz
src-9abf30435bf2380a875180dd87b8e7b23aaff9bf.zip
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
Notes
Notes: svn path=/head/; revision=55179
Diffstat (limited to 'bin')
-rw-r--r--bin/test/test.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/test/test.c b/bin/test/test.c
index e02559d3df72..c9df4e3cb758 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;