diff options
author | Ron Yorston <rmy@pobox.com> | 2023-07-27 12:20:18 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-07-27 12:20:18 +0100 |
commit | 9e2c3594ccbd3ef45beab57cba6796f97f06906c (patch) | |
tree | 64f6b0aa7bcdfa8b18c374a701cb09f60564f1b2 /libbb/appletlib.c | |
parent | df560c7c017c1084a180d922922358ed600faeb5 (diff) | |
download | busybox-w32-9e2c3594ccbd3ef45beab57cba6796f97f06906c.tar.gz busybox-w32-9e2c3594ccbd3ef45beab57cba6796f97f06906c.tar.bz2 busybox-w32-9e2c3594ccbd3ef45beab57cba6796f97f06906c.zip |
win32: fail early if UTF8 isn't supported
When the UTF8 manifest is included in the binary and ACP isn't UTF8
fail at once. This avoids raising false hopes if the binary is run
on Window 7/8. On Windows XP it won't even run.
When the busybox applet is run without arguments always report the
build-time configuration of globbing and the UTF8 manifest.
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 1c135fde7..a70b3a4c2 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -886,19 +886,20 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
886 | 886 | ||
887 | dup2(1, 2); | 887 | dup2(1, 2); |
888 | full_write2_str(bb_banner); /* reuse const string */ | 888 | full_write2_str(bb_banner); /* reuse const string */ |
889 | #if ENABLE_PLATFORM_MINGW32 | 889 | # if ENABLE_PLATFORM_MINGW32 |
890 | # if ENABLE_FEATURE_UTF8_MANIFEST | 890 | full_write2_str("\n("); |
891 | full_write2_str(GetACP() == CP_UTF8 ? " (Unicode on)" | 891 | # if defined(MINGW_VER) |
892 | : " (Unicode off)"); | ||
893 | # endif | ||
894 | full_write2_str("\n"); | ||
895 | #else | ||
896 | full_write2_str(" multi-call binary.\n"); /* reuse */ | ||
897 | #endif | ||
898 | #if defined(MINGW_VER) | ||
899 | if (sizeof(MINGW_VER) > 5) { | 892 | if (sizeof(MINGW_VER) > 5) { |
900 | full_write2_str(MINGW_VER "\n\n"); | 893 | full_write2_str(MINGW_VER "; "); |
901 | } | 894 | } |
895 | # endif | ||
896 | full_write2_str(ENABLE_GLOBBING ? "glob" : "noglob"); | ||
897 | # if ENABLE_FEATURE_UTF8_MANIFEST | ||
898 | full_write2_str("; Unicode"); | ||
899 | # endif | ||
900 | full_write2_str(")\n\n"); | ||
901 | # else | ||
902 | full_write2_str(" multi-call binary.\n"); /* reuse */ | ||
902 | #endif | 903 | #endif |
903 | full_write2_str( | 904 | full_write2_str( |
904 | "BusyBox is copyrighted by many authors between 1998-2023.\n" | 905 | "BusyBox is copyrighted by many authors between 1998-2023.\n" |
@@ -1303,6 +1304,14 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
1303 | } | 1304 | } |
1304 | #endif | 1305 | #endif |
1305 | #if ENABLE_PLATFORM_MINGW32 | 1306 | #if ENABLE_PLATFORM_MINGW32 |
1307 | # if ENABLE_FEATURE_UTF8_MANIFEST | ||
1308 | if (GetACP() != CP_UTF8) { | ||
1309 | full_write2_str(bb_basename(argv[0])); | ||
1310 | full_write2_str(": needs UTF8 code page\n"); | ||
1311 | return 1; | ||
1312 | } | ||
1313 | # endif | ||
1314 | |||
1306 | /* detect if we're running an interpreted script */ | 1315 | /* detect if we're running an interpreted script */ |
1307 | if (argv[0][1] == ':' && argv[0][2] == '/') { | 1316 | if (argv[0][1] == ':' && argv[0][2] == '/') { |
1308 | switch (argv[0][0]) { | 1317 | switch (argv[0][0]) { |