aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2023-02-18 15:48:41 +0100
committerJavier <dev.git@javispedro.com>2023-02-18 15:48:41 +0100
commit386e3e22c069cc306c6e0bd22fba824e1e13a7d9 (patch)
treecfa4966e563d7f27011f32165babe37f6f655cc9
parent4e62ff17398cbbe00ecd8cdcb1c791ab96b60c9c (diff)
downloadvbados-386e3e22c069cc306c6e0bd22fba824e1e13a7d9.tar.gz
vbados-386e3e22c069cc306c6e0bd22fba824e1e13a7d9.zip
replace .??? wildcards with a plain '*'
Before, patterns like 'test.???' would be passed as 'test' incorrectly. This fixes command.com which uses this pattern when searching for executable files.
-rw-r--r--sftsr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sftsr.c b/sftsr.c
index 73f09d5..0e9915f 100644
--- a/sftsr.c
+++ b/sftsr.c
@@ -277,11 +277,12 @@ static void fix_wildcards(SHFLSTRING *str, bool expand_tilde)
str->u16Length = i + 1;
}
} else if (str->u16Length >= 1+3) {
- // If this ends with .???, remove it, since we want to accept files
- // without extension too.
+ // Also, if this ends with .???, replace it with *,
+ // for the same reason.
i = str->u16Length - (1+3);
if (memcmp(&str->ach[i], ".???", (1+3)) == 0) {
- str->u16Length = i;
+ strcpy(&str->ach[i], "*");
+ str->u16Length = i + 1;
}
}