From d7ad2d9d5002e876691058b84b6bf9762950d553 Mon Sep 17 00:00:00 2001 From: sheldonh Date: Tue, 28 Dec 1999 09:34:57 +0000 Subject: Take into account the fact that "[" may be called with a path, for example "/bin/[". Reported by: Vlad Skvortsov Reported by: Peter Jeremy Message-Id: 99Dec27.111307est.40321@border.alcanet.com.au --- bin/test/test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bin/test') 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; -- cgit v1.1