From 13fc352af9a47da92ac0198c7a862c722f143508 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 8 Apr 2018 14:45:49 +0100 Subject: win32: more backslash to slash conversions Convert backslashes to slashes: - in the main program's argv[0] - in the shell's file argument Also, fix the code to remove the .exe extension from argv[0] in the main program. --- libbb/appletlib.c | 3 ++- shell/ash.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 3e740363a..8fae11998 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -1150,7 +1150,8 @@ int main(int argc UNUSED_PARAM, char **argv) char *s; str_tolower(argv[0]); - if (has_exe_suffix_or_dot(argv[0]) && !(s=strrchr(argv[0], '.'))) { + convert_slashes(argv[0]); + if (has_exe_suffix_or_dot(argv[0]) && (s=strrchr(argv[0], '.'))) { *s = '\0'; } } diff --git a/shell/ash.c b/shell/ash.c index ba05f073f..5ec035043 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -14593,6 +14593,9 @@ procargs(char **argv) goto setarg0; } else if (!sflag) { setinputfile(*xargv, 0); +#if ENABLE_PLATFORM_MINGW32 + convert_slashes(*xargv); +#endif setarg0: arg0 = *xargv++; commandname = arg0; -- cgit v1.2.3-55-g6feb