test: recognize /path/to/[ case too
This commit is contained in:
parent
8936a19880
commit
89bca27158
@ -182,22 +182,27 @@ static void initialize_group_array(void);
|
||||
int bb_test(int argc, char **argv)
|
||||
{
|
||||
int res;
|
||||
char *arg0;
|
||||
|
||||
if (LONE_CHAR(argv[0], '[')) {
|
||||
arg0 = strrchr(argv[0], '/');
|
||||
if (!arg0++) arg0 = argv[0];
|
||||
if (arg0[0] == '[') {
|
||||
if (!arg0[1]) { /* "[" ? */
|
||||
--argc;
|
||||
if (NOT_LONE_CHAR(argv[argc], ']')) {
|
||||
bb_error_msg("missing ]");
|
||||
return 2;
|
||||
}
|
||||
argv[argc] = NULL;
|
||||
} else if (strcmp(argv[0], "[[") == 0) {
|
||||
} else if (LONE_CHAR(arg0, '[') == 0) { /* "[[" ? */
|
||||
--argc;
|
||||
if (strcmp(argv[argc], "]]")) {
|
||||
if (strcmp(argv[argc], "]]") != 0) {
|
||||
bb_error_msg("missing ]]");
|
||||
return 2;
|
||||
}
|
||||
argv[argc] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
res = setjmp(leaving);
|
||||
if (res)
|
||||
|
Loading…
Reference in New Issue
Block a user