From 32f8610c8978673aa5d4f51097f955cdd14c13d8 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 12 Apr 2015 13:07:19 +0100 Subject: Allow globbing to be enabled with mingw64 mingw64 handles globbing differently from mingw32. Add code to allow globbing to be enabled. (By default mingw64 has globbing disabled, though the default can be changed when it's compiled.) Also change the configuration option from ENABLE_NOGLOB to ENABLE_GLOBBING, because double negatives make me think too much. The default is still for globbing to be disabled. --- Config.in | 17 +++++++++-------- README.md | 1 + configs/mingw32_defconfig | 4 ++-- win32/mingw.c | 21 +++++++++++++++------ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Config.in b/Config.in index c6aad4210..c2ee45dfd 100644 --- a/Config.in +++ b/Config.in @@ -630,16 +630,17 @@ config LFS cp, mount, tar, and many others. If you want to access files larger than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. -config NOGLOB - bool "Turn off MSVCRT argument processing" - default y +config GLOBBING + bool "Allow busybox.exe to expand wildcards" + default n depends on PLATFORM_MINGW32 help - The Microsoft C Runtime handles the expansion of wildcards on the - command line while the BusyBox shell does its own wildcard expansion. - For best results when using the shell MSVCRT globbing should be - turned off. If you want the BusyBox binary to handle wildcard - expansion using the Microsoft C Runtime set this to 'N'. + In Microsoft Windows expansion of wildcards on the command line + ('globbing') is handled by the C runtime while the BusyBox shell + does its own wildcard expansion. For best results when using the + shell globbing by the C runtime should be turned off. If you want + the BusyBox binary to handle wildcard expansion using the C runtime + set this to 'Y'. config CROSS_COMPILER_PREFIX string "Cross Compiler prefix" diff --git a/README.md b/README.md index 1ef735a74..ad5b475d3 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,4 @@ Then just `make`. - Use forward slashes in paths: Windows doesn't mind and the shell will be happier. - Don't do wild things with Windows drive or UNC notation. - tar doesn't support seamless compression/decompression: use a pipeline to a compressor/decompressor. + - Wildcard expansion is disabled by default, though it can be turned on at compile time. This only affects command line arguments to the binary: the BusyBox shell has full support for wildcards. diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig index b42a1a3cc..0608a8692 100644 --- a/configs/mingw32_defconfig +++ b/configs/mingw32_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.24.0.git -# Mon Mar 23 13:58:33 2015 +# Sun Apr 12 13:04:19 2015 # CONFIG_HAVE_DOT_CONFIG=y # CONFIG_PLATFORM_POSIX is not set @@ -66,7 +66,7 @@ CONFIG_BUSYBOX_EXEC_PATH="" # CONFIG_FEATURE_INDIVIDUAL is not set # CONFIG_FEATURE_SHARED_BUSYBOX is not set CONFIG_LFS=y -CONFIG_NOGLOB=y +# CONFIG_GLOBBING is not set CONFIG_CROSS_COMPILER_PREFIX="i686-w64-mingw32-" CONFIG_SYSROOT="" CONFIG_EXTRA_CFLAGS="" diff --git a/win32/mingw.c b/win32/mingw.c index d76f17820..514d00692 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -1,18 +1,27 @@ #include "libbb.h" #include -#if ENABLE_NOGLOB -/* disable MSVCRT command line globbing */ -int _CRT_glob = 0; +#if defined(__MINGW64_VERSION_MAJOR) +#if ENABLE_GLOBBING +int _dowildcard = -1; +#else +int _dowildcard = 0; #endif -#if !defined(__MINGW64_VERSION_MAJOR) -unsigned int _CRT_fmode = _O_BINARY; -#else #undef _fmode int _fmode = _O_BINARY; #endif +#if !defined(__MINGW64_VERSION_MAJOR) +#if ENABLE_GLOBBING +int _CRT_glob = 1; +#else +int _CRT_glob = 0; +#endif + +unsigned int _CRT_fmode = _O_BINARY; +#endif + smallint bb_got_signal; static int err_win_to_posix(DWORD winerr) -- cgit v1.2.3-55-g6feb