diff options
author | Ron Yorston <rmy@pobox.com> | 2019-01-10 08:38:15 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-01-10 08:38:15 +0000 |
commit | f99a280743e877c14ee90a3f9e93a34ca3476a27 (patch) | |
tree | 60ca3d17596e190c8c7cbca587168946598bee8a /libbb | |
parent | 40d5dd07ea1f290eaed30a03fd598e33a8eaf495 (diff) | |
parent | 6ca8e347fed8c24655df692f22694baf7c572770 (diff) | |
download | busybox-w32-f99a280743e877c14ee90a3f9e93a34ca3476a27.tar.gz busybox-w32-f99a280743e877c14ee90a3f9e93a34ca3476a27.tar.bz2 busybox-w32-f99a280743e877c14ee90a3f9e93a34ca3476a27.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/appletlib.c | 8 | ||||
-rw-r--r-- | libbb/lineedit.c | 32 | ||||
-rw-r--r-- | libbb/procps.c | 8 | ||||
-rw-r--r-- | libbb/signals.c | 10 |
4 files changed, 41 insertions, 17 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 3ff2b5dc6..8efb1754a 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -134,16 +134,16 @@ void FAST_FUNC bb_show_usage(void) | |||
134 | { | 134 | { |
135 | if (ENABLE_SHOW_USAGE) { | 135 | if (ENABLE_SHOW_USAGE) { |
136 | #ifdef SINGLE_APPLET_STR | 136 | #ifdef SINGLE_APPLET_STR |
137 | /* Imagine that this applet is "true". Dont suck in printf! */ | 137 | /* Imagine that this applet is "true". Dont link in printf! */ |
138 | const char *usage_string = unpack_usage_messages(); | 138 | const char *usage_string = unpack_usage_messages(); |
139 | 139 | ||
140 | if (usage_string) { | 140 | if (usage_string) { |
141 | if (*usage_string == '\b') { | 141 | if (*usage_string == '\b') { |
142 | full_write2_str("No help available.\n\n"); | 142 | full_write2_str("No help available\n"); |
143 | } else { | 143 | } else { |
144 | full_write2_str("Usage: "SINGLE_APPLET_STR" "); | 144 | full_write2_str("Usage: "SINGLE_APPLET_STR" "); |
145 | full_write2_str(usage_string); | 145 | full_write2_str(usage_string); |
146 | full_write2_str("\n\n"); | 146 | full_write2_str("\n"); |
147 | } | 147 | } |
148 | if (ENABLE_FEATURE_CLEAN_UP) | 148 | if (ENABLE_FEATURE_CLEAN_UP) |
149 | dealloc_usage_messages((char*)usage_string); | 149 | dealloc_usage_messages((char*)usage_string); |
@@ -162,7 +162,7 @@ void FAST_FUNC bb_show_usage(void) | |||
162 | full_write2_str(bb_banner); | 162 | full_write2_str(bb_banner); |
163 | full_write2_str(" multi-call binary\n"); | 163 | full_write2_str(" multi-call binary\n"); |
164 | if (*p == '\b') | 164 | if (*p == '\b') |
165 | full_write2_str("\nNo help available.\n\n"); | 165 | full_write2_str("\nNo help available\n"); |
166 | else { | 166 | else { |
167 | full_write2_str("\nUsage: "); | 167 | full_write2_str("\nUsage: "); |
168 | full_write2_str(applet_name); | 168 | full_write2_str(applet_name); |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 11a77ec69..0b4e326d8 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1444,6 +1444,16 @@ void FAST_FUNC show_history(const line_input_t *st) | |||
1444 | printf("%4d %s\n", i, st->history[i]); | 1444 | printf("%4d %s\n", i, st->history[i]); |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | void FAST_FUNC free_line_input_t(line_input_t *n) | ||
1448 | { | ||
1449 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY | ||
1450 | int i = n->cnt_history; | ||
1451 | while (i > 0) | ||
1452 | free(n->history[--i]); | ||
1453 | #endif | ||
1454 | free(n); | ||
1455 | } | ||
1456 | |||
1447 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY | 1457 | # if ENABLE_FEATURE_EDITING_SAVEHISTORY |
1448 | /* We try to ensure that concurrent additions to the history | 1458 | /* We try to ensure that concurrent additions to the history |
1449 | * do not overwrite each other. | 1459 | * do not overwrite each other. |
@@ -1453,14 +1463,6 @@ void FAST_FUNC show_history(const line_input_t *st) | |||
1453 | * than configured MAX_HISTORY lines. | 1463 | * than configured MAX_HISTORY lines. |
1454 | */ | 1464 | */ |
1455 | 1465 | ||
1456 | static void free_line_input_t(line_input_t *n) | ||
1457 | { | ||
1458 | int i = n->cnt_history; | ||
1459 | while (i > 0) | ||
1460 | free(n->history[--i]); | ||
1461 | free(n); | ||
1462 | } | ||
1463 | |||
1464 | /* state->flags is already checked to be nonzero */ | 1466 | /* state->flags is already checked to be nonzero */ |
1465 | static void load_history(line_input_t *st_parm) | 1467 | static void load_history(line_input_t *st_parm) |
1466 | { | 1468 | { |
@@ -2380,6 +2382,18 @@ static int32_t reverse_i_search(int timeout) | |||
2380 | } | 2382 | } |
2381 | #endif | 2383 | #endif |
2382 | 2384 | ||
2385 | #if ENABLE_FEATURE_EDITING_WINCH | ||
2386 | static void sigaction2(int sig, struct sigaction *act) | ||
2387 | { | ||
2388 | // Grr... gcc 8.1.1: | ||
2389 | // "passing argument 3 to restrict-qualified parameter aliases with argument 2" | ||
2390 | // dance around that... | ||
2391 | struct sigaction *oact FIX_ALIASING; | ||
2392 | oact = act; | ||
2393 | sigaction(sig, act, oact); | ||
2394 | } | ||
2395 | #endif | ||
2396 | |||
2383 | /* maxsize must be >= 2. | 2397 | /* maxsize must be >= 2. |
2384 | * Returns: | 2398 | * Returns: |
2385 | * -1 on read errors or EOF, or on bare Ctrl-D, | 2399 | * -1 on read errors or EOF, or on bare Ctrl-D, |
@@ -2500,7 +2514,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
2500 | /* Install window resize handler (NB: after *all* init is complete) */ | 2514 | /* Install window resize handler (NB: after *all* init is complete) */ |
2501 | S.SIGWINCH_handler.sa_handler = win_changed; | 2515 | S.SIGWINCH_handler.sa_handler = win_changed; |
2502 | S.SIGWINCH_handler.sa_flags = SA_RESTART; | 2516 | S.SIGWINCH_handler.sa_flags = SA_RESTART; |
2503 | sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler); | 2517 | sigaction2(SIGWINCH, &S.SIGWINCH_handler); |
2504 | #endif | 2518 | #endif |
2505 | read_key_buffer[0] = 0; | 2519 | read_key_buffer[0] = 0; |
2506 | while (1) { | 2520 | while (1) { |
diff --git a/libbb/procps.c b/libbb/procps.c index 2484ab2d9..e6892d7ff 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -121,11 +121,11 @@ void FAST_FUNC free_procps_scan(procps_status_t* sp) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | #if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP | 123 | #if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP |
124 | static unsigned long fast_strtoul_16(char **endptr) | 124 | static unsigned long long fast_strtoull_16(char **endptr) |
125 | { | 125 | { |
126 | unsigned char c; | 126 | unsigned char c; |
127 | char *str = *endptr; | 127 | char *str = *endptr; |
128 | unsigned long n = 0; | 128 | unsigned long long n = 0; |
129 | 129 | ||
130 | /* Need to stop on both ' ' and '\n' */ | 130 | /* Need to stop on both ' ' and '\n' */ |
131 | while ((c = *str++) > ' ') { | 131 | while ((c = *str++) > ' ') { |
@@ -239,8 +239,8 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | |||
239 | 239 | ||
240 | *tp = ' '; | 240 | *tp = ' '; |
241 | tp = buf; | 241 | tp = buf; |
242 | currec.smap_start = fast_strtoul_16(&tp); | 242 | currec.smap_start = fast_strtoull_16(&tp); |
243 | currec.smap_size = (fast_strtoul_16(&tp) - currec.smap_start) >> 10; | 243 | currec.smap_size = (fast_strtoull_16(&tp) - currec.smap_start) >> 10; |
244 | 244 | ||
245 | strncpy(currec.smap_mode, tp, sizeof(currec.smap_mode)-1); | 245 | strncpy(currec.smap_mode, tp, sizeof(currec.smap_mode)-1); |
246 | 246 | ||
diff --git a/libbb/signals.c b/libbb/signals.c index 3f589321c..d3d84ef6a 100644 --- a/libbb/signals.c +++ b/libbb/signals.c | |||
@@ -31,6 +31,16 @@ int FAST_FUNC sigprocmask_allsigs(int how) | |||
31 | return sigprocmask(how, &set, NULL); | 31 | return sigprocmask(how, &set, NULL); |
32 | } | 32 | } |
33 | 33 | ||
34 | int FAST_FUNC sigprocmask2(int how, sigset_t *set) | ||
35 | { | ||
36 | // Grr... gcc 8.1.1: | ||
37 | // "passing argument 3 to restrict-qualified parameter aliases with argument 2" | ||
38 | // dance around that... | ||
39 | sigset_t *oset FIX_ALIASING; | ||
40 | oset = set; | ||
41 | return sigprocmask(how, set, oset); | ||
42 | } | ||
43 | |||
34 | void FAST_FUNC bb_signals(int sigs, void (*f)(int)) | 44 | void FAST_FUNC bb_signals(int sigs, void (*f)(int)) |
35 | { | 45 | { |
36 | int sig_no = 0; | 46 | int sig_no = 0; |