diff options
author | Ron Yorston <rmy@pobox.com> | 2024-09-28 08:13:32 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-09-28 08:13:32 +0100 |
commit | 431e2704c17d5c0e51a0cbebfb1105bd4962b3f7 (patch) | |
tree | 6ff19e48cdcab8ba8176d22813d39a375399a610 | |
parent | 940f40e371695d6b247f4b406e7eb580fb91e866 (diff) | |
parent | dff444bc375e6eb4c6775dbfc753ba71b46e9797 (diff) | |
download | busybox-w32-431e2704c17d5c0e51a0cbebfb1105bd4962b3f7.tar.gz busybox-w32-431e2704c17d5c0e51a0cbebfb1105bd4962b3f7.tar.bz2 busybox-w32-431e2704c17d5c0e51a0cbebfb1105bd4962b3f7.zip |
Merge branch 'busybox' into merge
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | editors/ed.c | 2 | ||||
-rw-r--r-- | include/libbb.h | 10 | ||||
-rw-r--r-- | libbb/appletlib.c | 70 | ||||
-rw-r--r-- | libbb/lineedit.c | 7 | ||||
-rw-r--r-- | networking/wget.c | 9 | ||||
-rw-r--r-- | scripts/basic/fixdep.c | 11 | ||||
-rw-r--r-- | shell/ash.c | 6 | ||||
-rw-r--r-- | shell/hush.c | 70 | ||||
-rw-r--r-- | util-linux/hwclock.c | 2 |
10 files changed, 87 insertions, 102 deletions
@@ -1,5 +1,5 @@ | |||
1 | VERSION = 1 | 1 | VERSION = 1 |
2 | PATCHLEVEL = 37 | 2 | PATCHLEVEL = 38 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = .git | 4 | EXTRAVERSION = .git |
5 | NAME = Unnamed | 5 | NAME = Unnamed |
diff --git a/editors/ed.c b/editors/ed.c index e25179ddc..a02634ec7 100644 --- a/editors/ed.c +++ b/editors/ed.c | |||
@@ -345,10 +345,8 @@ static int insertLine(int num, const char *data, int len) | |||
345 | lp->prev->next = newLp; | 345 | lp->prev->next = newLp; |
346 | lp->prev = newLp; | 346 | lp->prev = newLp; |
347 | 347 | ||
348 | #if ENABLE_PLATFORM_MINGW32 | ||
349 | if (num <= curNum) | 348 | if (num <= curNum) |
350 | curLine = curLine->prev; | 349 | curLine = curLine->prev; |
351 | #endif | ||
352 | lastNum++; | 350 | lastNum++; |
353 | dirty = TRUE; | 351 | dirty = TRUE; |
354 | return setCurNum(num); | 352 | return setCurNum(num); |
diff --git a/include/libbb.h b/include/libbb.h index 17fb6fae6..b68f9b684 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -2092,11 +2092,11 @@ enum { | |||
2092 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION | LI_INTERRUPTIBLE, | 2092 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION | LI_INTERRUPTIBLE, |
2093 | }; | 2093 | }; |
2094 | line_input_t *new_line_input_t(int flags) FAST_FUNC; | 2094 | line_input_t *new_line_input_t(int flags) FAST_FUNC; |
2095 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY | 2095 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY |
2096 | void free_line_input_t(line_input_t *n) FAST_FUNC; | 2096 | void free_line_input_t(line_input_t *n) FAST_FUNC; |
2097 | #else | 2097 | # else |
2098 | # define free_line_input_t(n) free(n) | 2098 | # define free_line_input_t(n) free(n) |
2099 | #endif | 2099 | # endif |
2100 | /* | 2100 | /* |
2101 | * maxsize must be >= 2. | 2101 | * maxsize must be >= 2. |
2102 | * Returns: | 2102 | * Returns: |
@@ -2107,7 +2107,7 @@ void free_line_input_t(line_input_t *n) FAST_FUNC; | |||
2107 | int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize) FAST_FUNC; | 2107 | int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize) FAST_FUNC; |
2108 | void show_history(const line_input_t *st) FAST_FUNC; | 2108 | void show_history(const line_input_t *st) FAST_FUNC; |
2109 | # if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT | 2109 | # if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT |
2110 | void save_history(line_input_t *st); | 2110 | void save_history(line_input_t *st) FAST_FUNC; |
2111 | # endif | 2111 | # endif |
2112 | #else | 2112 | #else |
2113 | #define MAX_HISTORY 0 | 2113 | #define MAX_HISTORY 0 |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 1ff7fe6c8..27ce8a6e8 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -144,17 +144,19 @@ static const char packed_usage[] ALIGN1 = { PACKED_USAGE }; | |||
144 | void FAST_FUNC bb_show_usage(void) | 144 | void FAST_FUNC bb_show_usage(void) |
145 | { | 145 | { |
146 | if (ENABLE_SHOW_USAGE) { | 146 | if (ENABLE_SHOW_USAGE) { |
147 | ssize_t FAST_FUNC (*full_write_fn)(const char *) = | ||
148 | xfunc_error_retval ? full_write2_str : full_write1_str; | ||
147 | #ifdef SINGLE_APPLET_STR | 149 | #ifdef SINGLE_APPLET_STR |
148 | /* Imagine that this applet is "true". Dont link in printf! */ | 150 | /* Imagine that this applet is "true". Dont link in printf! */ |
149 | const char *usage_string = unpack_usage_messages(); | 151 | const char *usage_string = unpack_usage_messages(); |
150 | 152 | ||
151 | if (usage_string) { | 153 | if (usage_string) { |
152 | if (*usage_string == '\b') { | 154 | if (*usage_string == '\b') { |
153 | full_write2_str("No help available\n"); | 155 | full_write_fn("No help available\n"); |
154 | } else { | 156 | } else { |
155 | full_write2_str("Usage: "SINGLE_APPLET_STR" "); | 157 | full_write_fn("Usage: "SINGLE_APPLET_STR" "); |
156 | full_write2_str(usage_string); | 158 | full_write_fn(usage_string); |
157 | full_write2_str("\n"); | 159 | full_write_fn("\n"); |
158 | } | 160 | } |
159 | if (ENABLE_FEATURE_CLEAN_UP) | 161 | if (ENABLE_FEATURE_CLEAN_UP) |
160 | dealloc_usage_messages((char*)usage_string); | 162 | dealloc_usage_messages((char*)usage_string); |
@@ -170,23 +172,23 @@ void FAST_FUNC bb_show_usage(void) | |||
170 | while (*p++) continue; | 172 | while (*p++) continue; |
171 | ap--; | 173 | ap--; |
172 | } | 174 | } |
173 | full_write2_str(bb_banner); | 175 | full_write_fn(bb_banner); |
174 | #if ENABLE_PLATFORM_MINGW32 | 176 | #if ENABLE_PLATFORM_MINGW32 |
175 | full_write2_str("\n"); | 177 | full_write_fn("\n"); |
176 | #else | 178 | #else |
177 | full_write2_str(" multi-call binary.\n"); /* common string */ | 179 | full_write_fn(" multi-call binary.\n"); /* common string */ |
178 | #endif | 180 | #endif |
179 | if (*p == '\b') | 181 | if (*p == '\b') |
180 | full_write2_str("\nNo help available\n"); | 182 | full_write_fn("\nNo help available\n"); |
181 | else { | 183 | else { |
182 | full_write2_str("\nUsage: "); | 184 | full_write_fn("\nUsage: "); |
183 | full_write2_str(applet_name); | 185 | full_write_fn(applet_name); |
184 | if (p[0]) { | 186 | if (p[0]) { |
185 | if (p[0] != '\n') | 187 | if (p[0] != '\n') |
186 | full_write2_str(" "); | 188 | full_write_fn(" "); |
187 | full_write2_str(p); | 189 | full_write_fn(p); |
188 | } | 190 | } |
189 | full_write2_str("\n"); | 191 | full_write_fn("\n"); |
190 | } | 192 | } |
191 | if (ENABLE_FEATURE_CLEAN_UP) | 193 | if (ENABLE_FEATURE_CLEAN_UP) |
192 | dealloc_usage_messages((char*)usage_string); | 194 | dealloc_usage_messages((char*)usage_string); |
@@ -371,8 +373,10 @@ void lbb_prepare(const char *applet | |||
371 | && !(ENABLE_TRUE && strcmp(applet_name, "true") == 0) | 373 | && !(ENABLE_TRUE && strcmp(applet_name, "true") == 0) |
372 | && !(ENABLE_FALSE && strcmp(applet_name, "false") == 0) | 374 | && !(ENABLE_FALSE && strcmp(applet_name, "false") == 0) |
373 | && !(ENABLE_ECHO && strcmp(applet_name, "echo") == 0) | 375 | && !(ENABLE_ECHO && strcmp(applet_name, "echo") == 0) |
374 | ) | 376 | ) { |
377 | xfunc_error_retval = 0; | ||
375 | bb_show_usage(); | 378 | bb_show_usage(); |
379 | } | ||
376 | } | 380 | } |
377 | #endif | 381 | #endif |
378 | } | 382 | } |
@@ -912,24 +916,23 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
912 | help: | 916 | help: |
913 | output_width = get_terminal_width(2); | 917 | output_width = get_terminal_width(2); |
914 | 918 | ||
915 | dup2(1, 2); | 919 | full_write1_str(bb_banner); /* reuse const string */ |
916 | full_write2_str(bb_banner); /* reuse const string */ | ||
917 | # if ENABLE_PLATFORM_MINGW32 | 920 | # if ENABLE_PLATFORM_MINGW32 |
918 | full_write2_str("\n("); | 921 | full_write1_str("\n("); |
919 | # if defined(MINGW_VER) | 922 | # if defined(MINGW_VER) |
920 | if (sizeof(MINGW_VER) > 5) { | 923 | if (sizeof(MINGW_VER) > 5) { |
921 | full_write2_str(MINGW_VER "; "); | 924 | full_write1_str(MINGW_VER "; "); |
922 | } | 925 | } |
923 | # endif | 926 | # endif |
924 | full_write2_str(ENABLE_GLOBBING ? "glob" : "noglob"); | 927 | full_write1_str(ENABLE_GLOBBING ? "glob" : "noglob"); |
925 | # if ENABLE_FEATURE_UTF8_MANIFEST | 928 | # if ENABLE_FEATURE_UTF8_MANIFEST |
926 | full_write2_str("; Unicode"); | 929 | full_write1_str("; Unicode"); |
927 | # endif | 930 | # endif |
928 | full_write2_str(")\n\n"); | 931 | full_write1_str(")\n\n"); |
929 | # else | 932 | # else |
930 | full_write2_str(" multi-call binary.\n"); /* reuse */ | 933 | full_write1_str(" multi-call binary.\n"); /* reuse */ |
931 | #endif | 934 | #endif |
932 | full_write2_str( | 935 | full_write1_str( |
933 | "BusyBox is copyrighted by many authors between 1998-2024.\n" | 936 | "BusyBox is copyrighted by many authors between 1998-2024.\n" |
934 | "Licensed under GPLv2. See source distribution for detailed\n" | 937 | "Licensed under GPLv2. See source distribution for detailed\n" |
935 | "copyright notices.\n" | 938 | "copyright notices.\n" |
@@ -973,20 +976,20 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
973 | while (*a) { | 976 | while (*a) { |
974 | int len2 = strlen(a) + 2; | 977 | int len2 = strlen(a) + 2; |
975 | if (col >= (int)output_width - len2) { | 978 | if (col >= (int)output_width - len2) { |
976 | full_write2_str(",\n"); | 979 | full_write1_str(",\n"); |
977 | col = 0; | 980 | col = 0; |
978 | } | 981 | } |
979 | if (col == 0) { | 982 | if (col == 0) { |
980 | col = 6; | 983 | col = 6; |
981 | full_write2_str("\t"); | 984 | full_write1_str("\t"); |
982 | } else { | 985 | } else { |
983 | full_write2_str(", "); | 986 | full_write1_str(", "); |
984 | } | 987 | } |
985 | full_write2_str(a); | 988 | full_write1_str(a); |
986 | col += len2; | 989 | col += len2; |
987 | a += len2 - 1; | 990 | a += len2 - 1; |
988 | } | 991 | } |
989 | full_write2_str("\n"); | 992 | full_write1_str("\n"); |
990 | return 0; | 993 | return 0; |
991 | } | 994 | } |
992 | 995 | ||
@@ -1006,11 +1009,10 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
1006 | if (is_prefixed_with(argv[1], "--list")) { | 1009 | if (is_prefixed_with(argv[1], "--list")) { |
1007 | unsigned i = 0; | 1010 | unsigned i = 0; |
1008 | const char *a = applet_names; | 1011 | const char *a = applet_names; |
1009 | dup2(1, 2); | ||
1010 | while (*a) { | 1012 | while (*a) { |
1011 | # if ENABLE_FEATURE_INSTALLER && !ENABLE_PLATFORM_MINGW32 | 1013 | # if ENABLE_FEATURE_INSTALLER && !ENABLE_PLATFORM_MINGW32 |
1012 | if (argv[1][6]) /* --list-full? */ | 1014 | if (argv[1][6]) /* --list-full? */ |
1013 | full_write2_str(install_dir[APPLET_INSTALL_LOC(i)] + 1); | 1015 | full_write1_str(install_dir[APPLET_INSTALL_LOC(i)] + 1); |
1014 | # elif ENABLE_PLATFORM_MINGW32 && (ENABLE_FEATURE_PREFER_APPLETS \ | 1016 | # elif ENABLE_PLATFORM_MINGW32 && (ENABLE_FEATURE_PREFER_APPLETS \ |
1015 | || ENABLE_FEATURE_SH_STANDALONE \ | 1017 | || ENABLE_FEATURE_SH_STANDALONE \ |
1016 | || ENABLE_FEATURE_SH_NOFORK) | 1018 | || ENABLE_FEATURE_SH_NOFORK) |
@@ -1027,12 +1029,12 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
1027 | # endif | 1029 | # endif |
1028 | else | 1030 | else |
1029 | str = " "; | 1031 | str = " "; |
1030 | full_write2_str(str); | 1032 | full_write1_str(str); |
1031 | full_write2_str(install_dir[APPLET_INSTALL_LOC(i)] + 1); | 1033 | full_write1_str(install_dir[APPLET_INSTALL_LOC(i)] + 1); |
1032 | } | 1034 | } |
1033 | # endif | 1035 | # endif |
1034 | full_write2_str(a); | 1036 | full_write1_str(a); |
1035 | full_write2_str("\n"); | 1037 | full_write1_str("\n"); |
1036 | i++; | 1038 | i++; |
1037 | while (*a++ != '\0') | 1039 | while (*a++ != '\0') |
1038 | continue; | 1040 | continue; |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 7f26bb8e0..8e2b37853 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1653,12 +1653,7 @@ void FAST_FUNC show_history(const line_input_t *st) | |||
1653 | if (!st) | 1653 | if (!st) |
1654 | return; | 1654 | return; |
1655 | for (i = 0; i < st->cnt_history; i++) | 1655 | for (i = 0; i < st->cnt_history; i++) |
1656 | #if ENABLE_PLATFORM_MINGW32 | ||
1657 | /* Upstream erred, a patch has been submitted */ | ||
1658 | printf("%4d %s\n", i, st->history[i]); | 1656 | printf("%4d %s\n", i, st->history[i]); |
1659 | #else | ||
1660 | fprintf(stderr, "%4d %s\n", i, st->history[i]); | ||
1661 | #endif | ||
1662 | } | 1657 | } |
1663 | 1658 | ||
1664 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY | 1659 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY |
@@ -1750,7 +1745,7 @@ static void load_history(line_input_t *st_parm) | |||
1750 | } | 1745 | } |
1751 | 1746 | ||
1752 | # if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT | 1747 | # if ENABLE_FEATURE_EDITING_SAVE_ON_EXIT |
1753 | void save_history(line_input_t *st) | 1748 | void FAST_FUNC save_history(line_input_t *st) |
1754 | { | 1749 | { |
1755 | FILE *fp; | 1750 | FILE *fp; |
1756 | 1751 | ||
diff --git a/networking/wget.c b/networking/wget.c index ae847044e..6a64836fb 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -1218,7 +1218,9 @@ static void download_one_url(const char *url) | |||
1218 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ | 1218 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ |
1219 | G.got_clen = 0; | 1219 | G.got_clen = 0; |
1220 | G.chunked = 0; | 1220 | G.chunked = 0; |
1221 | if (use_proxy || target.protocol[0] != 'f' /*not ftp[s]*/) { | 1221 | if (!ENABLE_FEATURE_WGET_FTP |
1222 | || use_proxy || target.protocol[0] != 'f' /*not ftp[s]*/ | ||
1223 | ) { | ||
1222 | /* | 1224 | /* |
1223 | * HTTP session | 1225 | * HTTP session |
1224 | */ | 1226 | */ |
@@ -1500,14 +1502,15 @@ However, in real world it was observed that some web servers | |||
1500 | 1502 | ||
1501 | /* For HTTP, data is pumped over the same connection */ | 1503 | /* For HTTP, data is pumped over the same connection */ |
1502 | dfp = sfp; | 1504 | dfp = sfp; |
1503 | } else { | 1505 | } |
1504 | #if ENABLE_FEATURE_WGET_FTP | 1506 | #if ENABLE_FEATURE_WGET_FTP |
1507 | else { | ||
1505 | /* | 1508 | /* |
1506 | * FTP session | 1509 | * FTP session |
1507 | */ | 1510 | */ |
1508 | sfp = prepare_ftp_session(&dfp, &target, lsa); | 1511 | sfp = prepare_ftp_session(&dfp, &target, lsa); |
1509 | #endif | ||
1510 | } | 1512 | } |
1513 | #endif | ||
1511 | 1514 | ||
1512 | free(lsa); | 1515 | free(lsa); |
1513 | 1516 | ||
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 1ae25c919..47a0cee07 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -107,6 +107,7 @@ | |||
107 | #ifndef __MINGW32__ | 107 | #ifndef __MINGW32__ |
108 | #include <sys/mman.h> | 108 | #include <sys/mman.h> |
109 | #endif | 109 | #endif |
110 | #include <errno.h> | ||
110 | #include <unistd.h> | 111 | #include <unistd.h> |
111 | #include <fcntl.h> | 112 | #include <fcntl.h> |
112 | #include <string.h> | 113 | #include <string.h> |
@@ -347,7 +348,10 @@ void do_config_file(char *filename) | |||
347 | perror(filename); | 348 | perror(filename); |
348 | exit(2); | 349 | exit(2); |
349 | } | 350 | } |
350 | fstat(fd, &st); | 351 | if (fstat(fd, &st) < 0) { |
352 | fprintf(stderr, "fixdep: fstat %s %s\n", filename, strerror(errno)); | ||
353 | exit(2); | ||
354 | } | ||
351 | if (st.st_size == 0) { | 355 | if (st.st_size == 0) { |
352 | close(fd); | 356 | close(fd); |
353 | return; | 357 | return; |
@@ -425,7 +429,10 @@ void print_deps(void) | |||
425 | perror(depfile); | 429 | perror(depfile); |
426 | exit(2); | 430 | exit(2); |
427 | } | 431 | } |
428 | fstat(fd, &st); | 432 | if (fstat(fd, &st) < 0) { |
433 | fprintf(stderr, "fixdep: fstat %s %s\n", depfile, strerror(errno)); | ||
434 | exit(2); | ||
435 | } | ||
429 | if (st.st_size == 0) { | 436 | if (st.st_size == 0) { |
430 | fprintf(stderr,"fixdep: %s is empty\n",depfile); | 437 | fprintf(stderr,"fixdep: %s is empty\n",depfile); |
431 | close(fd); | 438 | close(fd); |
diff --git a/shell/ash.c b/shell/ash.c index 8bbc19d1f..8a3659542 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -12821,16 +12821,12 @@ options(int *login_sh) | |||
12821 | if (val && (c == '-')) { /* long options */ | 12821 | if (val && (c == '-')) { /* long options */ |
12822 | if (strcmp(p, "login") == 0) { | 12822 | if (strcmp(p, "login") == 0) { |
12823 | *login_sh = 1; | 12823 | *login_sh = 1; |
12824 | #if ENABLE_PLATFORM_MINGW32 | ||
12825 | break; | 12824 | break; |
12826 | #endif | ||
12827 | } | 12825 | } |
12828 | /* TODO: --noprofile: e.g. if I want to run emergency shell from sulogin, | 12826 | /* TODO: --noprofile: e.g. if I want to run emergency shell from sulogin, |
12829 | * I want minimal/no shell init scripts - but it insists on running it as "-ash"... | 12827 | * I want minimal/no shell init scripts - but it insists on running it as "-ash"... |
12830 | */ | 12828 | */ |
12831 | #if !ENABLE_PLATFORM_MINGW32 | 12829 | ash_msg_and_raise_error("bad option '%s'", p - 2); |
12832 | break; | ||
12833 | #endif | ||
12834 | } | 12830 | } |
12835 | } | 12831 | } |
12836 | if (c == 'o') { | 12832 | if (c == 'o') { |
diff --git a/shell/hush.c b/shell/hush.c index 707b77c9c..6b6ec7c6b 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -390,7 +390,6 @@ | |||
390 | #define BASH_TEST2 (ENABLE_HUSH_BASH_COMPAT && ENABLE_HUSH_TEST) | 390 | #define BASH_TEST2 (ENABLE_HUSH_BASH_COMPAT && ENABLE_HUSH_TEST) |
391 | #define BASH_READ_D ENABLE_HUSH_BASH_COMPAT | 391 | #define BASH_READ_D ENABLE_HUSH_BASH_COMPAT |
392 | 392 | ||
393 | |||
394 | /* Build knobs */ | 393 | /* Build knobs */ |
395 | #define LEAK_HUNTING 0 | 394 | #define LEAK_HUNTING 0 |
396 | #define BUILD_AS_NOMMU 0 | 395 | #define BUILD_AS_NOMMU 0 |
@@ -411,7 +410,6 @@ | |||
411 | */ | 410 | */ |
412 | #define ENABLE_HUSH_DOLLAR_OPS 1 | 411 | #define ENABLE_HUSH_DOLLAR_OPS 1 |
413 | 412 | ||
414 | |||
415 | #if BUILD_AS_NOMMU | 413 | #if BUILD_AS_NOMMU |
416 | # undef BB_MMU | 414 | # undef BB_MMU |
417 | # undef USE_FOR_NOMMU | 415 | # undef USE_FOR_NOMMU |
@@ -640,7 +638,6 @@ typedef enum redir_type { | |||
640 | HEREDOC_QUOTED = 2, | 638 | HEREDOC_QUOTED = 2, |
641 | } redir_type; | 639 | } redir_type; |
642 | 640 | ||
643 | |||
644 | struct command { | 641 | struct command { |
645 | pid_t pid; /* 0 if exited */ | 642 | pid_t pid; /* 0 if exited */ |
646 | unsigned assignment_cnt; /* how many argv[i] are assignments? */ | 643 | unsigned assignment_cnt; /* how many argv[i] are assignments? */ |
@@ -798,7 +795,6 @@ struct function { | |||
798 | }; | 795 | }; |
799 | #endif | 796 | #endif |
800 | 797 | ||
801 | |||
802 | /* set -/+o OPT support. (TODO: make it optional) | 798 | /* set -/+o OPT support. (TODO: make it optional) |
803 | * bash supports the following opts: | 799 | * bash supports the following opts: |
804 | * allexport off | 800 | * allexport off |
@@ -1046,7 +1042,6 @@ struct globals { | |||
1046 | G.sa.sa_flags = SA_RESTART; \ | 1042 | G.sa.sa_flags = SA_RESTART; \ |
1047 | } while (0) | 1043 | } while (0) |
1048 | 1044 | ||
1049 | |||
1050 | /* Function prototypes for builtins */ | 1045 | /* Function prototypes for builtins */ |
1051 | static int builtin_cd(char **argv) FAST_FUNC; | 1046 | static int builtin_cd(char **argv) FAST_FUNC; |
1052 | #if ENABLE_HUSH_ECHO | 1047 | #if ENABLE_HUSH_ECHO |
@@ -1248,8 +1243,8 @@ static const struct built_in_command bltins2[] ALIGN_PTR = { | |||
1248 | #endif | 1243 | #endif |
1249 | }; | 1244 | }; |
1250 | 1245 | ||
1251 | 1246 | /* | |
1252 | /* Debug printouts. | 1247 | * Debug printouts. |
1253 | */ | 1248 | */ |
1254 | #if HUSH_DEBUG >= 2 | 1249 | #if HUSH_DEBUG >= 2 |
1255 | /* prevent disasters with G.debug_indent < 0 */ | 1250 | /* prevent disasters with G.debug_indent < 0 */ |
@@ -1342,8 +1337,8 @@ static void debug_print_strings(const char *prefix, char **vv) | |||
1342 | # define debug_print_strings(prefix, vv) ((void)0) | 1337 | # define debug_print_strings(prefix, vv) ((void)0) |
1343 | #endif | 1338 | #endif |
1344 | 1339 | ||
1345 | 1340 | /* | |
1346 | /* Leak hunting. Use hush_leaktool.sh for post-processing. | 1341 | * Leak hunting. Use hush_leaktool.sh for post-processing. |
1347 | */ | 1342 | */ |
1348 | #if LEAK_HUNTING | 1343 | #if LEAK_HUNTING |
1349 | static void *xxmalloc(int lineno, size_t size) | 1344 | static void *xxmalloc(int lineno, size_t size) |
@@ -1375,8 +1370,8 @@ static void xxfree(void *ptr) | |||
1375 | # define free(p) xxfree(p) | 1370 | # define free(p) xxfree(p) |
1376 | #endif | 1371 | #endif |
1377 | 1372 | ||
1378 | 1373 | /* | |
1379 | /* Syntax and runtime errors. They always abort scripts. | 1374 | * Syntax and runtime errors. They always abort scripts. |
1380 | * In interactive use they usually discard unparsed and/or unexecuted commands | 1375 | * In interactive use they usually discard unparsed and/or unexecuted commands |
1381 | * and return to the prompt. | 1376 | * and return to the prompt. |
1382 | * HUSH_DEBUG >= 2 prints line number in this file where it was detected. | 1377 | * HUSH_DEBUG >= 2 prints line number in this file where it was detected. |
@@ -1469,8 +1464,8 @@ static void syntax_error_unexpected_ch(unsigned lineno UNUSED_PARAM, int ch) | |||
1469 | # define syntax_error_unexpected_ch(ch) syntax_error_unexpected_ch(__LINE__, ch) | 1464 | # define syntax_error_unexpected_ch(ch) syntax_error_unexpected_ch(__LINE__, ch) |
1470 | #endif | 1465 | #endif |
1471 | 1466 | ||
1472 | 1467 | /* | |
1473 | /* Utility functions | 1468 | * Utility functions |
1474 | */ | 1469 | */ |
1475 | /* Replace each \x with x in place, return ptr past NUL. */ | 1470 | /* Replace each \x with x in place, return ptr past NUL. */ |
1476 | static char *unbackslash(char *src) | 1471 | static char *unbackslash(char *src) |
@@ -1616,8 +1611,9 @@ static int xdup_CLOEXEC_and_close(int fd, int avoid_fd) | |||
1616 | return newfd; | 1611 | return newfd; |
1617 | } | 1612 | } |
1618 | 1613 | ||
1619 | 1614 | /* | |
1620 | /* Manipulating HFILEs */ | 1615 | * Manipulating HFILEs |
1616 | */ | ||
1621 | static HFILE *hfopen(const char *name) | 1617 | static HFILE *hfopen(const char *name) |
1622 | { | 1618 | { |
1623 | HFILE *fp; | 1619 | HFILE *fp; |
@@ -1763,8 +1759,8 @@ static int fd_in_HFILEs(int fd) | |||
1763 | return 0; | 1759 | return 0; |
1764 | } | 1760 | } |
1765 | 1761 | ||
1766 | 1762 | /* | |
1767 | /* Helpers for setting new $n and restoring them back | 1763 | * Helpers for setting new $n and restoring them back |
1768 | */ | 1764 | */ |
1769 | typedef struct save_arg_t { | 1765 | typedef struct save_arg_t { |
1770 | char *sv_argv0; | 1766 | char *sv_argv0; |
@@ -1804,8 +1800,8 @@ static void restore_G_args(save_arg_t *sv, char **argv) | |||
1804 | IF_HUSH_SET(G.global_args_malloced = sv->sv_g_malloced;) | 1800 | IF_HUSH_SET(G.global_args_malloced = sv->sv_g_malloced;) |
1805 | } | 1801 | } |
1806 | 1802 | ||
1807 | 1803 | /* | |
1808 | /* Basic theory of signal handling in shell | 1804 | * Basic theory of signal handling in shell |
1809 | * ======================================== | 1805 | * ======================================== |
1810 | * This does not describe what hush does, rather, it is current understanding | 1806 | * This does not describe what hush does, rather, it is current understanding |
1811 | * what it _should_ do. If it doesn't, it's a bug. | 1807 | * what it _should_ do. If it doesn't, it's a bug. |
@@ -2246,7 +2242,9 @@ static int check_and_run_traps(void) | |||
2246 | return last_sig; | 2242 | return last_sig; |
2247 | } | 2243 | } |
2248 | 2244 | ||
2249 | 2245 | /* | |
2246 | * Shell and environment variable support | ||
2247 | */ | ||
2250 | static const char *get_cwd(int force) | 2248 | static const char *get_cwd(int force) |
2251 | { | 2249 | { |
2252 | if (force || G.cwd == NULL) { | 2250 | if (force || G.cwd == NULL) { |
@@ -2261,10 +2259,6 @@ static const char *get_cwd(int force) | |||
2261 | return G.cwd; | 2259 | return G.cwd; |
2262 | } | 2260 | } |
2263 | 2261 | ||
2264 | |||
2265 | /* | ||
2266 | * Shell and environment variable support | ||
2267 | */ | ||
2268 | static struct variable **get_ptr_to_local_var(const char *name) | 2262 | static struct variable **get_ptr_to_local_var(const char *name) |
2269 | { | 2263 | { |
2270 | struct variable **pp; | 2264 | struct variable **pp; |
@@ -2538,7 +2532,6 @@ static int unset_local_var(const char *name) | |||
2538 | } | 2532 | } |
2539 | #endif | 2533 | #endif |
2540 | 2534 | ||
2541 | |||
2542 | /* | 2535 | /* |
2543 | * Helpers for "var1=val1 var2=val2 cmd" feature | 2536 | * Helpers for "var1=val1 var2=val2 cmd" feature |
2544 | */ | 2537 | */ |
@@ -2612,7 +2605,6 @@ static void set_vars_and_save_old(char **strings) | |||
2612 | free(strings); | 2605 | free(strings); |
2613 | } | 2606 | } |
2614 | 2607 | ||
2615 | |||
2616 | /* | 2608 | /* |
2617 | * Unicode helper | 2609 | * Unicode helper |
2618 | */ | 2610 | */ |
@@ -2971,7 +2963,6 @@ static void setup_string_in_str(struct in_str *i, const char *s) | |||
2971 | i->p = s; | 2963 | i->p = s; |
2972 | } | 2964 | } |
2973 | 2965 | ||
2974 | |||
2975 | /* | 2966 | /* |
2976 | * o_string support | 2967 | * o_string support |
2977 | */ | 2968 | */ |
@@ -3703,9 +3694,9 @@ static void free_pipe_list(struct pipe *pi) | |||
3703 | } | 3694 | } |
3704 | } | 3695 | } |
3705 | 3696 | ||
3706 | 3697 | /* | |
3707 | /*** Parsing routines ***/ | 3698 | * Parsing routines |
3708 | 3699 | */ | |
3709 | #ifndef debug_print_tree | 3700 | #ifndef debug_print_tree |
3710 | static void debug_print_tree(struct pipe *pi, int lvl) | 3701 | static void debug_print_tree(struct pipe *pi, int lvl) |
3711 | { | 3702 | { |
@@ -4339,7 +4330,6 @@ static int done_word(struct parse_context *ctx) | |||
4339 | return 0; | 4330 | return 0; |
4340 | } | 4331 | } |
4341 | 4332 | ||
4342 | |||
4343 | /* Peek ahead in the input to find out if we have a "&n" construct, | 4333 | /* Peek ahead in the input to find out if we have a "&n" construct, |
4344 | * as in "2>&1", that represents duplicating a file descriptor. | 4334 | * as in "2>&1", that represents duplicating a file descriptor. |
4345 | * Return: | 4335 | * Return: |
@@ -4635,7 +4625,6 @@ static int fetch_heredocs(o_string *as_string, struct pipe *pi, int heredoc_cnt, | |||
4635 | return heredoc_cnt; | 4625 | return heredoc_cnt; |
4636 | } | 4626 | } |
4637 | 4627 | ||
4638 | |||
4639 | static int run_list(struct pipe *pi); | 4628 | static int run_list(struct pipe *pi); |
4640 | #if BB_MMU | 4629 | #if BB_MMU |
4641 | #define parse_stream(pstring, heredoc_cnt_ptr, input, end_trigger) \ | 4630 | #define parse_stream(pstring, heredoc_cnt_ptr, input, end_trigger) \ |
@@ -6082,9 +6071,9 @@ static struct pipe *parse_stream(char **pstring, | |||
6082 | } | 6071 | } |
6083 | } | 6072 | } |
6084 | 6073 | ||
6085 | 6074 | /* | |
6086 | /*** Execution routines ***/ | 6075 | * Execution routines |
6087 | 6076 | */ | |
6088 | /* Expansion can recurse, need forward decls: */ | 6077 | /* Expansion can recurse, need forward decls: */ |
6089 | #if !BASH_PATTERN_SUBST && !ENABLE_HUSH_CASE | 6078 | #if !BASH_PATTERN_SUBST && !ENABLE_HUSH_CASE |
6090 | #define expand_string_to_string(str, EXP_flags, do_unbackslash) \ | 6079 | #define expand_string_to_string(str, EXP_flags, do_unbackslash) \ |
@@ -7347,7 +7336,6 @@ static char **expand_assignments(char **argv, int count) | |||
7347 | return p; | 7336 | return p; |
7348 | } | 7337 | } |
7349 | 7338 | ||
7350 | |||
7351 | static void switch_off_special_sigs(unsigned mask) | 7339 | static void switch_off_special_sigs(unsigned mask) |
7352 | { | 7340 | { |
7353 | unsigned sig = 0; | 7341 | unsigned sig = 0; |
@@ -7565,7 +7553,6 @@ static void re_execute_shell(char ***to_free, const char *s, | |||
7565 | } | 7553 | } |
7566 | #endif /* !BB_MMU */ | 7554 | #endif /* !BB_MMU */ |
7567 | 7555 | ||
7568 | |||
7569 | static int run_and_free_list(struct pipe *pi); | 7556 | static int run_and_free_list(struct pipe *pi); |
7570 | 7557 | ||
7571 | /* Executing from string: eval, sh -c '...' | 7558 | /* Executing from string: eval, sh -c '...' |
@@ -7796,7 +7783,6 @@ static int process_command_subs(o_string *dest, const char *s) | |||
7796 | } | 7783 | } |
7797 | #endif /* ENABLE_HUSH_TICK */ | 7784 | #endif /* ENABLE_HUSH_TICK */ |
7798 | 7785 | ||
7799 | |||
7800 | static void setup_heredoc(struct redir_struct *redir) | 7786 | static void setup_heredoc(struct redir_struct *redir) |
7801 | { | 7787 | { |
7802 | struct fd_pair pair; | 7788 | struct fd_pair pair; |
@@ -8524,7 +8510,6 @@ static int run_function(const struct function *funcp, char **argv) | |||
8524 | } | 8510 | } |
8525 | #endif /* ENABLE_HUSH_FUNCTIONS */ | 8511 | #endif /* ENABLE_HUSH_FUNCTIONS */ |
8526 | 8512 | ||
8527 | |||
8528 | #if BB_MMU | 8513 | #if BB_MMU |
8529 | #define exec_builtin(to_free, x, argv) \ | 8514 | #define exec_builtin(to_free, x, argv) \ |
8530 | exec_builtin(x, argv) | 8515 | exec_builtin(x, argv) |
@@ -8558,7 +8543,6 @@ static void exec_builtin(char ***to_free, | |||
8558 | #endif | 8543 | #endif |
8559 | } | 8544 | } |
8560 | 8545 | ||
8561 | |||
8562 | static void execvp_or_die(char **argv) NORETURN; | 8546 | static void execvp_or_die(char **argv) NORETURN; |
8563 | static void execvp_or_die(char **argv) | 8547 | static void execvp_or_die(char **argv) |
8564 | { | 8548 | { |
@@ -10184,7 +10168,9 @@ static int run_and_free_list(struct pipe *pi) | |||
10184 | return rcode; | 10168 | return rcode; |
10185 | } | 10169 | } |
10186 | 10170 | ||
10187 | 10171 | /* | |
10172 | * Initialization and main | ||
10173 | */ | ||
10188 | static void install_sighandlers(unsigned mask) | 10174 | static void install_sighandlers(unsigned mask) |
10189 | { | 10175 | { |
10190 | sighandler_t old_handler; | 10176 | sighandler_t old_handler; |
@@ -10861,7 +10847,6 @@ int hush_main(int argc, char **argv) | |||
10861 | hush_exit(G.last_exitcode); | 10847 | hush_exit(G.last_exitcode); |
10862 | } | 10848 | } |
10863 | 10849 | ||
10864 | |||
10865 | /* | 10850 | /* |
10866 | * Built-ins | 10851 | * Built-ins |
10867 | */ | 10852 | */ |
@@ -12340,7 +12325,6 @@ static int FAST_FUNC builtin_memleak(char **argv UNUSED_PARAM) | |||
12340 | if (l < (unsigned long)p) l = (unsigned long)p; | 12325 | if (l < (unsigned long)p) l = (unsigned long)p; |
12341 | free(p); | 12326 | free(p); |
12342 | 12327 | ||
12343 | |||
12344 | # if 0 /* debug */ | 12328 | # if 0 /* debug */ |
12345 | { | 12329 | { |
12346 | struct mallinfo mi = mallinfo(); | 12330 | struct mallinfo mi = mallinfo(); |
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index e6f0043d0..c3fd0eb57 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c | |||
@@ -366,7 +366,7 @@ static void set_rtc_param(const char **pp_rtcname, char *rtc_param) | |||
366 | /* handle param name */ | 366 | /* handle param name */ |
367 | eq = strchr(rtc_param, '='); | 367 | eq = strchr(rtc_param, '='); |
368 | if (!eq) | 368 | if (!eq) |
369 | bb_error_msg_and_die("expected <param>=<value>"); | 369 | bb_simple_error_msg_and_die("expected <param>=<value>"); |
370 | *eq = '\0'; | 370 | *eq = '\0'; |
371 | param.param = resolve_rtc_param_alias(rtc_param); | 371 | param.param = resolve_rtc_param_alias(rtc_param); |
372 | *eq = '='; | 372 | *eq = '='; |