diff options
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 95e589e74..1d6a4b274 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -62,6 +62,7 @@ static const char usage_messages[] ALIGN1 = UNPACKED_USAGE; | |||
62 | #if ENABLE_FEATURE_COMPRESS_USAGE | 62 | #if ENABLE_FEATURE_COMPRESS_USAGE |
63 | 63 | ||
64 | static const char packed_usage[] ALIGN1 = { PACKED_USAGE }; | 64 | static const char packed_usage[] ALIGN1 = { PACKED_USAGE }; |
65 | #define BB_ARCHIVE_PUBLIC | ||
65 | # include "bb_archive.h" | 66 | # include "bb_archive.h" |
66 | static const char *unpack_usage_messages(void) | 67 | static const char *unpack_usage_messages(void) |
67 | { | 68 | { |
@@ -187,6 +188,10 @@ void lbb_prepare(const char *applet | |||
187 | if (ENABLE_LOCALE_SUPPORT) | 188 | if (ENABLE_LOCALE_SUPPORT) |
188 | setlocale(LC_ALL, ""); | 189 | setlocale(LC_ALL, ""); |
189 | 190 | ||
191 | #if ENABLE_PLATFORM_MINGW32 | ||
192 | init_winsock(); | ||
193 | #endif | ||
194 | |||
190 | #if ENABLE_FEATURE_INDIVIDUAL | 195 | #if ENABLE_FEATURE_INDIVIDUAL |
191 | /* Redundant for busybox (run_applet_and_exit covers that case) | 196 | /* Redundant for busybox (run_applet_and_exit covers that case) |
192 | * but needed for "individual applet" mode */ | 197 | * but needed for "individual applet" mode */ |
@@ -629,6 +634,11 @@ static int busybox_main(char **argv) | |||
629 | dup2(1, 2); | 634 | dup2(1, 2); |
630 | full_write2_str(bb_banner); /* reuse const string */ | 635 | full_write2_str(bb_banner); /* reuse const string */ |
631 | full_write2_str(" multi-call binary.\n"); /* reuse */ | 636 | full_write2_str(" multi-call binary.\n"); /* reuse */ |
637 | #if defined(MINGW_VER) | ||
638 | if (strlen(MINGW_VER)) { | ||
639 | full_write2_str(MINGW_VER "\n\n"); | ||
640 | } | ||
641 | #endif | ||
632 | full_write2_str( | 642 | full_write2_str( |
633 | "BusyBox is copyrighted by many authors between 1998-2015.\n" | 643 | "BusyBox is copyrighted by many authors between 1998-2015.\n" |
634 | "Licensed under GPLv2. See source distribution for detailed\n" | 644 | "Licensed under GPLv2. See source distribution for detailed\n" |
@@ -655,6 +665,11 @@ static int busybox_main(char **argv) | |||
655 | "\tTo run external program, use full path (/sbin/ip instead of ip).\n" | 665 | "\tTo run external program, use full path (/sbin/ip instead of ip).\n" |
656 | ) | 666 | ) |
657 | "\n" | 667 | "\n" |
668 | #if ENABLE_GLOBBING | ||
669 | "\tSupport for native Windows wildcards is enabled. In some\n" | ||
670 | "\tcases this may result in wildcards being processed twice.\n" | ||
671 | "\n" | ||
672 | #endif | ||
658 | "Currently defined functions:\n" | 673 | "Currently defined functions:\n" |
659 | ); | 674 | ); |
660 | col = 0; | 675 | col = 0; |
@@ -825,6 +840,18 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
825 | } | 840 | } |
826 | #endif | 841 | #endif |
827 | 842 | ||
843 | #if defined(__MINGW64_VERSION_MAJOR) | ||
844 | if ( stdin ) { | ||
845 | _setmode(fileno(stdin), _O_BINARY); | ||
846 | } | ||
847 | if ( stdout ) { | ||
848 | _setmode(fileno(stdout), _O_BINARY); | ||
849 | } | ||
850 | if ( stderr ) { | ||
851 | _setmode(fileno(stderr), _O_BINARY); | ||
852 | } | ||
853 | #endif | ||
854 | |||
828 | #if defined(SINGLE_APPLET_MAIN) | 855 | #if defined(SINGLE_APPLET_MAIN) |
829 | /* Only one applet is selected in .config */ | 856 | /* Only one applet is selected in .config */ |
830 | if (argv[1] && is_prefixed_with(argv[0], "busybox")) { | 857 | if (argv[1] && is_prefixed_with(argv[0], "busybox")) { |
@@ -840,6 +867,29 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
840 | applet_name = argv[0]; | 867 | applet_name = argv[0]; |
841 | if (applet_name[0] == '-') | 868 | if (applet_name[0] == '-') |
842 | applet_name++; | 869 | applet_name++; |
870 | if (ENABLE_PLATFORM_MINGW32) { | ||
871 | const char *applet_name_env = getenv("BUSYBOX_APPLET_NAME"); | ||
872 | if (applet_name_env && *applet_name_env) { | ||
873 | applet_name = applet_name_env; | ||
874 | unsetenv("BUSYBOX_APPLET_NAME"); | ||
875 | } | ||
876 | else if ( argv[1] && argv[2] && strcmp(argv[1], "--busybox") == 0 ) { | ||
877 | argv += 2; | ||
878 | applet_name = argv[0]; | ||
879 | } | ||
880 | else { | ||
881 | char *s = argv[0]; | ||
882 | int i, len = strlen(s); | ||
883 | |||
884 | for ( i=0; i < len; ++i ) { | ||
885 | s[i] = tolower(s[i]); | ||
886 | } | ||
887 | if (len > 4 && !strcmp(s+len-4, ".exe")) { | ||
888 | len -= 4; | ||
889 | s[len] = '\0'; | ||
890 | } | ||
891 | } | ||
892 | } | ||
843 | applet_name = bb_basename(applet_name); | 893 | applet_name = bb_basename(applet_name); |
844 | 894 | ||
845 | parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ | 895 | parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ |