diff options
author | Ron Yorston <rmy@pobox.com> | 2022-06-27 11:23:39 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-06-27 11:23:39 +0100 |
commit | b0f279a48f5f7e57b6f6e941e4b59e9a1bc54548 (patch) | |
tree | 86430f2929d8e3eb162bcb83c512bf8a0fffe322 | |
parent | 164a4253b1b16f3923b175f425074ef2d1b04377 (diff) | |
parent | 2617a5e4c600b4577b2c18f794701276e55da43b (diff) | |
download | busybox-w32-b0f279a48f5f7e57b6f6e941e4b59e9a1bc54548.tar.gz busybox-w32-b0f279a48f5f7e57b6f6e941e4b59e9a1bc54548.tar.bz2 busybox-w32-b0f279a48f5f7e57b6f6e941e4b59e9a1bc54548.zip |
Merge branch 'busybox' into merge
-rw-r--r-- | editors/vi.c | 75 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/convert2ipconf | 16 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/convert2ntpconf | 2 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/dhcp_handler | 6 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/finish | 2 | ||||
-rw-r--r-- | include/libbb.h | 11 | ||||
-rw-r--r-- | libbb/lineedit.c | 12 | ||||
-rw-r--r-- | libbb/perror_nomsg.c | 4 | ||||
-rw-r--r-- | libbb/perror_nomsg_and_die.c | 4 | ||||
-rw-r--r-- | procps/top.c | 5 | ||||
-rw-r--r-- | shell/ash.c | 7 | ||||
-rw-r--r-- | shell/hush.c | 5 |
12 files changed, 95 insertions, 54 deletions
diff --git a/editors/vi.c b/editors/vi.c index e28db3ab6..b813747d1 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -413,7 +413,9 @@ struct globals { | |||
413 | char *last_search_pattern; // last pattern from a '/' or '?' search | 413 | char *last_search_pattern; // last pattern from a '/' or '?' search |
414 | #endif | 414 | #endif |
415 | #if ENABLE_FEATURE_VI_SETOPTS | 415 | #if ENABLE_FEATURE_VI_SETOPTS |
416 | int indentcol; // column of recently autoindent, 0 or -1 | 416 | int char_insert__indentcol; // column of recent autoindent or 0 |
417 | int newindent; // autoindent value for 'O'/'cc' commands | ||
418 | // or -1 to use indent from previous line | ||
417 | #endif | 419 | #endif |
418 | #if ENABLE_FEATURE_VI_FILE_FORMAT | 420 | #if ENABLE_FEATURE_VI_FILE_FORMAT |
419 | smallint fileformat; | 421 | smallint fileformat; |
@@ -546,7 +548,8 @@ struct globals { | |||
546 | #define ioq_start (G.ioq_start ) | 548 | #define ioq_start (G.ioq_start ) |
547 | #define dotcnt (G.dotcnt ) | 549 | #define dotcnt (G.dotcnt ) |
548 | #define last_search_pattern (G.last_search_pattern) | 550 | #define last_search_pattern (G.last_search_pattern) |
549 | #define indentcol (G.indentcol ) | 551 | #define char_insert__indentcol (G.char_insert__indentcol) |
552 | #define newindent (G.newindent ) | ||
550 | #define fileformat (G.fileformat ) | 553 | #define fileformat (G.fileformat ) |
551 | #define fileformats (G.fileformats ) | 554 | #define fileformats (G.fileformats ) |
552 | #define cmd_error (G.cmd_error ) | 555 | #define cmd_error (G.cmd_error ) |
@@ -581,10 +584,11 @@ struct globals { | |||
581 | 584 | ||
582 | #define INIT_G() do { \ | 585 | #define INIT_G() do { \ |
583 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ | 586 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ |
584 | last_modified_count = -1; \ | 587 | last_modified_count--; \ |
585 | /* "" but has space for 2 chars: */ \ | 588 | /* "" but has space for 2 chars: */ \ |
586 | IF_FEATURE_VI_SEARCH(last_search_pattern = xzalloc(2);) \ | 589 | IF_FEATURE_VI_SEARCH(last_search_pattern = xzalloc(2);) \ |
587 | tabstop = 8; \ | 590 | tabstop = 8; \ |
591 | IF_FEATURE_VI_SETOPTS(newindent--;) \ | ||
588 | } while (0) | 592 | } while (0) |
589 | 593 | ||
590 | #if ENABLE_FEATURE_VI_CRASHME | 594 | #if ENABLE_FEATURE_VI_CRASHME |
@@ -2204,6 +2208,7 @@ static size_t indent_len(char *p) | |||
2204 | static char *char_insert(char *p, char c, int undo) // insert the char c at 'p' | 2208 | static char *char_insert(char *p, char c, int undo) // insert the char c at 'p' |
2205 | { | 2209 | { |
2206 | #if ENABLE_FEATURE_VI_SETOPTS | 2210 | #if ENABLE_FEATURE_VI_SETOPTS |
2211 | # define indentcol char_insert__indentcol | ||
2207 | size_t len; | 2212 | size_t len; |
2208 | int col, ntab, nspc; | 2213 | int col, ntab, nspc; |
2209 | #endif | 2214 | #endif |
@@ -2232,7 +2237,8 @@ static char *char_insert(char *p, char c, int undo) // insert the char c at 'p' | |||
2232 | #if ENABLE_FEATURE_VI_SETOPTS | 2237 | #if ENABLE_FEATURE_VI_SETOPTS |
2233 | if (autoindent) { | 2238 | if (autoindent) { |
2234 | len = indent_len(bol); | 2239 | len = indent_len(bol); |
2235 | if (len && get_column(bol + len) == indentcol && bol[len] == '\n') { | 2240 | col = get_column(bol + len); |
2241 | if (len && col == indentcol && bol[len] == '\n') { | ||
2236 | // remove autoindent from otherwise empty line | 2242 | // remove autoindent from otherwise empty line |
2237 | text_hole_delete(bol, bol + len - 1, undo); | 2243 | text_hole_delete(bol, bol + len - 1, undo); |
2238 | p = bol; | 2244 | p = bol; |
@@ -2301,24 +2307,31 @@ static char *char_insert(char *p, char c, int undo) // insert the char c at 'p' | |||
2301 | showmatching(p - 1); | 2307 | showmatching(p - 1); |
2302 | } | 2308 | } |
2303 | if (autoindent && c == '\n') { // auto indent the new line | 2309 | if (autoindent && c == '\n') { // auto indent the new line |
2304 | // use indent of current/previous line | 2310 | if (newindent < 0) { |
2305 | bol = indentcol < 0 ? p : prev_line(p); | 2311 | // use indent of previous line |
2306 | len = indent_len(bol); | 2312 | bol = prev_line(p); |
2307 | col = get_column(bol + len); | 2313 | len = indent_len(bol); |
2308 | 2314 | col = get_column(bol + len); | |
2309 | if (len && col == indentcol) { | 2315 | |
2310 | // previous line was empty except for autoindent | 2316 | if (len && col == indentcol) { |
2311 | // move the indent to the current line | 2317 | // previous line was empty except for autoindent |
2312 | memmove(bol + 1, bol, len); | 2318 | // move the indent to the current line |
2313 | *bol = '\n'; | 2319 | memmove(bol + 1, bol, len); |
2314 | return p; | 2320 | *bol = '\n'; |
2321 | return p; | ||
2322 | } | ||
2323 | } else { | ||
2324 | // for 'O'/'cc' commands add indent before newly inserted NL | ||
2325 | if (p != end - 1) // but not for 'cc' at EOF | ||
2326 | p--; | ||
2327 | col = newindent; | ||
2315 | } | 2328 | } |
2316 | 2329 | ||
2317 | if (indentcol < 0) | 2330 | if (col) { |
2318 | p--; // open above, indent before newly inserted NL | 2331 | // only record indent if in insert/replace mode or for |
2319 | 2332 | // the 'o'/'O'/'cc' commands, which are switched to | |
2320 | if (len) { | 2333 | // insert mode early. |
2321 | indentcol = col; | 2334 | indentcol = cmd_mode != 0 ? col : 0; |
2322 | if (expandtab) { | 2335 | if (expandtab) { |
2323 | ntab = 0; | 2336 | ntab = 0; |
2324 | nspc = col; | 2337 | nspc = col; |
@@ -2340,6 +2353,7 @@ static char *char_insert(char *p, char c, int undo) // insert the char c at 'p' | |||
2340 | } | 2353 | } |
2341 | #if ENABLE_FEATURE_VI_SETOPTS | 2354 | #if ENABLE_FEATURE_VI_SETOPTS |
2342 | indentcol = 0; | 2355 | indentcol = 0; |
2356 | # undef indentcol | ||
2343 | #endif | 2357 | #endif |
2344 | return p; | 2358 | return p; |
2345 | } | 2359 | } |
@@ -4373,6 +4387,9 @@ static void do_cmd(int c) | |||
4373 | case 'i': // i- insert before current char | 4387 | case 'i': // i- insert before current char |
4374 | case KEYCODE_INSERT: // Cursor Key Insert | 4388 | case KEYCODE_INSERT: // Cursor Key Insert |
4375 | dc_i: | 4389 | dc_i: |
4390 | #if ENABLE_FEATURE_VI_SETOPTS | ||
4391 | newindent = -1; | ||
4392 | #endif | ||
4376 | cmd_mode = 1; // start inserting | 4393 | cmd_mode = 1; // start inserting |
4377 | undo_queue_commit(); // commit queue when cmd_mode changes | 4394 | undo_queue_commit(); // commit queue when cmd_mode changes |
4378 | break; | 4395 | break; |
@@ -4415,12 +4432,16 @@ static void do_cmd(int c) | |||
4415 | case 'O': // O- open an empty line above | 4432 | case 'O': // O- open an empty line above |
4416 | dot_begin(); | 4433 | dot_begin(); |
4417 | #if ENABLE_FEATURE_VI_SETOPTS | 4434 | #if ENABLE_FEATURE_VI_SETOPTS |
4418 | indentcol = -1; | 4435 | // special case: use indent of current line |
4436 | newindent = get_column(dot + indent_len(dot)); | ||
4419 | #endif | 4437 | #endif |
4420 | goto dc3; | 4438 | goto dc3; |
4421 | case 'o': // o- open an empty line below | 4439 | case 'o': // o- open an empty line below |
4422 | dot_end(); | 4440 | dot_end(); |
4423 | dc3: | 4441 | dc3: |
4442 | #if ENABLE_FEATURE_VI_SETOPTS | ||
4443 | cmd_mode = 1; // switch to insert mode early | ||
4444 | #endif | ||
4424 | dot = char_insert(dot, '\n', ALLOW_UNDO); | 4445 | dot = char_insert(dot, '\n', ALLOW_UNDO); |
4425 | if (c == 'O' && !autoindent) { | 4446 | if (c == 'O' && !autoindent) { |
4426 | // done in char_insert() for 'O'+autoindent | 4447 | // done in char_insert() for 'O'+autoindent |
@@ -4535,14 +4556,22 @@ static void do_cmd(int c) | |||
4535 | if (buftype == WHOLE) { | 4556 | if (buftype == WHOLE) { |
4536 | save_dot = p; // final cursor position is start of range | 4557 | save_dot = p; // final cursor position is start of range |
4537 | p = begin_line(p); | 4558 | p = begin_line(p); |
4559 | #if ENABLE_FEATURE_VI_SETOPTS | ||
4560 | if (c == 'c') // special case: use indent of current line | ||
4561 | newindent = get_column(p + indent_len(p)); | ||
4562 | #endif | ||
4538 | q = end_line(q); | 4563 | q = end_line(q); |
4539 | } | 4564 | } |
4540 | dot = yank_delete(p, q, buftype, yf, ALLOW_UNDO); // delete word | 4565 | dot = yank_delete(p, q, buftype, yf, ALLOW_UNDO); // delete word |
4541 | if (buftype == WHOLE) { | 4566 | if (buftype == WHOLE) { |
4542 | if (c == 'c') { | 4567 | if (c == 'c') { |
4568 | #if ENABLE_FEATURE_VI_SETOPTS | ||
4569 | cmd_mode = 1; // switch to insert mode early | ||
4570 | #endif | ||
4543 | dot = char_insert(dot, '\n', ALLOW_UNDO_CHAIN); | 4571 | dot = char_insert(dot, '\n', ALLOW_UNDO_CHAIN); |
4544 | // on the last line of file don't move to prev line | 4572 | // on the last line of file don't move to prev line, |
4545 | if (dot != (end-1)) { | 4573 | // handled in char_insert() if autoindent is enabled |
4574 | if (dot != (end-1) && !autoindent) { | ||
4546 | dot_prev(); | 4575 | dot_prev(); |
4547 | } | 4576 | } |
4548 | } else if (c == 'd') { | 4577 | } else if (c == 'd') { |
diff --git a/examples/var_service/dhcp_if/convert2ipconf b/examples/var_service/dhcp_if/convert2ipconf index 31e3c7fde..98f6546bf 100755 --- a/examples/var_service/dhcp_if/convert2ipconf +++ b/examples/var_service/dhcp_if/convert2ipconf | |||
@@ -19,7 +19,7 @@ | |||
19 | #let cfg=cfg+1 | 19 | #let cfg=cfg+1 |
20 | #if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=... | 20 | #if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=... |
21 | 21 | ||
22 | exec >/dev/null | 22 | #exec >/dev/null |
23 | #exec >"$0.out" # debug | 23 | #exec >"$0.out" # debug |
24 | exec 2>&1 | 24 | exec 2>&1 |
25 | 25 | ||
@@ -31,23 +31,31 @@ test "$ip" || exit 1 | |||
31 | if ! test "$mask"; then | 31 | if ! test "$mask"; then |
32 | case "$ip" in | 32 | case "$ip" in |
33 | 10.*) | 33 | 10.*) |
34 | echo "mask assumed 8 for ip=$ip" | ||
34 | mask=8;; | 35 | mask=8;; |
35 | 192.168.*) | ||
36 | mask=16;; | ||
37 | #172.16-31.x.x | 36 | #172.16-31.x.x |
38 | 172.1[6789].*) | 37 | 172.1[6789].*) |
38 | echo "mask assumed 12 for ip=$ip" | ||
39 | mask=12;; | 39 | mask=12;; |
40 | 172.2[0123456789].*) | 40 | 172.2[0123456789].*) |
41 | echo "mask assumed 12 for ip=$ip" | ||
41 | mask=12;; | 42 | mask=12;; |
42 | 172.3[01].*) | 43 | 172.3[01].*) |
44 | echo "mask assumed 12 for ip=$ip" | ||
43 | mask=12;; | 45 | mask=12;; |
46 | 192.168.*) | ||
47 | echo "mask assumed 16 for ip=$ip" | ||
48 | mask=16;; | ||
44 | esac | 49 | esac |
45 | fi | 50 | fi |
46 | 51 | ||
47 | # some servers do not return router option. | 52 | # some servers do not return router option. |
48 | # assume DHCP server is the router. | 53 | # assume DHCP server is the router. |
49 | if ! test "$router"; then | 54 | if ! test "$router"; then |
50 | test "$serverid" && router="$serverid" | 55 | if test "$serverid"; then |
56 | router="$serverid" | ||
57 | echo "No 'router' from the server, assuming 'serverid' is the router: $serverid" | ||
58 | fi | ||
51 | fi | 59 | fi |
52 | 60 | ||
53 | { | 61 | { |
diff --git a/examples/var_service/dhcp_if/convert2ntpconf b/examples/var_service/dhcp_if/convert2ntpconf index e9d829308..f51740ba0 100755 --- a/examples/var_service/dhcp_if/convert2ntpconf +++ b/examples/var_service/dhcp_if/convert2ntpconf | |||
@@ -19,7 +19,7 @@ | |||
19 | #let cfg=cfg+1 | 19 | #let cfg=cfg+1 |
20 | #ntpip[$cfg]=... | 20 | #ntpip[$cfg]=... |
21 | 21 | ||
22 | exec >/dev/null | 22 | #exec >/dev/null |
23 | #exec >"$0.out" # debug | 23 | #exec >"$0.out" # debug |
24 | exec 2>&1 | 24 | exec 2>&1 |
25 | 25 | ||
diff --git a/examples/var_service/dhcp_if/dhcp_handler b/examples/var_service/dhcp_if/dhcp_handler index 6a97e8543..3e652621d 100755 --- a/examples/var_service/dhcp_if/dhcp_handler +++ b/examples/var_service/dhcp_if/dhcp_handler | |||
@@ -38,12 +38,10 @@ file_ntpconf="$service.ntpconf" | |||
38 | dir_ipconf="/var/run/service/fw" | 38 | dir_ipconf="/var/run/service/fw" |
39 | dir_ntpconf="/var/run/service/ntpd" | 39 | dir_ntpconf="/var/run/service/ntpd" |
40 | 40 | ||
41 | exec >/dev/null | 41 | #exec >/dev/null |
42 | #exec >>"$0.out" #debug | 42 | #exec >"$0.out" #debug |
43 | exec 2>&1 | 43 | exec 2>&1 |
44 | 44 | ||
45 | echo "`date`: Params: $*" | ||
46 | |||
47 | if test x"$1" != x"bound" && test x"$1" != x"renew" ; then | 45 | if test x"$1" != x"bound" && test x"$1" != x"renew" ; then |
48 | # Reconfigure network with this interface disabled | 46 | # Reconfigure network with this interface disabled |
49 | echo "Deconfiguring" | 47 | echo "Deconfiguring" |
diff --git a/examples/var_service/dhcp_if/finish b/examples/var_service/dhcp_if/finish index 8ce188336..50bfe67b5 100755 --- a/examples/var_service/dhcp_if/finish +++ b/examples/var_service/dhcp_if/finish | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # executed when service is taken down ("sv d .") | 2 | # executed when service is taken down ("svc -d .") |
3 | 3 | ||
4 | service=${PWD##*/} | 4 | service=${PWD##*/} |
5 | file_ipconf="$service.ipconf" | 5 | file_ipconf="$service.ipconf" |
diff --git a/include/libbb.h b/include/libbb.h index 6e4e7583f..c5691c76d 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1992,6 +1992,7 @@ unsigned size_from_HISTFILESIZE(const char *hp) FAST_FUNC; | |||
1992 | # define MAX_HISTORY 0 | 1992 | # define MAX_HISTORY 0 |
1993 | # endif | 1993 | # endif |
1994 | typedef const char *get_exe_name_t(int i) FAST_FUNC; | 1994 | typedef const char *get_exe_name_t(int i) FAST_FUNC; |
1995 | typedef const char *sh_get_var_t(const char *name) FAST_FUNC; | ||
1995 | typedef struct line_input_t { | 1996 | typedef struct line_input_t { |
1996 | int flags; | 1997 | int flags; |
1997 | int timeout; | 1998 | int timeout; |
@@ -2005,9 +2006,8 @@ typedef struct line_input_t { | |||
2005 | # if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH | 2006 | # if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH |
2006 | /* function to fetch additional application-specific names to match */ | 2007 | /* function to fetch additional application-specific names to match */ |
2007 | get_exe_name_t *get_exe_name; | 2008 | get_exe_name_t *get_exe_name; |
2008 | # define EDITING_HAS_get_exe_name 1 | 2009 | /* function to fetch value of shell variable */ |
2009 | # else | 2010 | sh_get_var_t *sh_get_var; |
2010 | # define EDITING_HAS_get_exe_name 0 | ||
2011 | # endif | 2011 | # endif |
2012 | # endif | 2012 | # endif |
2013 | # if MAX_HISTORY | 2013 | # if MAX_HISTORY |
@@ -2061,11 +2061,6 @@ int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; | |||
2061 | read_line_input(prompt, command, maxsize) | 2061 | read_line_input(prompt, command, maxsize) |
2062 | #endif | 2062 | #endif |
2063 | 2063 | ||
2064 | #ifndef EDITING_HAS_get_exe_name | ||
2065 | # define EDITING_HAS_get_exe_name 0 | ||
2066 | #endif | ||
2067 | |||
2068 | |||
2069 | #ifndef COMM_LEN | 2064 | #ifndef COMM_LEN |
2070 | # ifdef TASK_COMM_LEN | 2065 | # ifdef TASK_COMM_LEN |
2071 | enum { COMM_LEN = TASK_COMM_LEN }; | 2066 | enum { COMM_LEN = TASK_COMM_LEN }; |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index c06b104ff..6994d1da7 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -259,6 +259,16 @@ static const char *get_username_str(void) | |||
259 | 259 | ||
260 | static NOINLINE const char *get_homedir_or_NULL(void) | 260 | static NOINLINE const char *get_homedir_or_NULL(void) |
261 | { | 261 | { |
262 | const char *home; | ||
263 | |||
264 | # if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH | ||
265 | home = state->sh_get_var ? state->sh_get_var("HOME") : getenv("HOME"); | ||
266 | # else | ||
267 | home = getenv("HOME"); | ||
268 | # endif | ||
269 | if (home != NULL && home[0] != '\0') | ||
270 | return home; | ||
271 | |||
262 | if (!got_user_strings) | 272 | if (!got_user_strings) |
263 | get_user_strings(); | 273 | get_user_strings(); |
264 | return home_pwd_buf; | 274 | return home_pwd_buf; |
@@ -932,7 +942,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type) | |||
932 | continue; | 942 | continue; |
933 | } | 943 | } |
934 | # endif | 944 | # endif |
935 | # if EDITING_HAS_get_exe_name | 945 | # if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH |
936 | if (state->get_exe_name) { | 946 | if (state->get_exe_name) { |
937 | i = 0; | 947 | i = 0; |
938 | for (;;) { | 948 | for (;;) { |
diff --git a/libbb/perror_nomsg.c b/libbb/perror_nomsg.c index d7d53de44..a2a11cc8e 100644 --- a/libbb/perror_nomsg.c +++ b/libbb/perror_nomsg.c | |||
@@ -12,11 +12,11 @@ | |||
12 | * instead of including libbb.h */ | 12 | * instead of including libbb.h */ |
13 | //#include "libbb.h" | 13 | //#include "libbb.h" |
14 | #include "platform.h" | 14 | #include "platform.h" |
15 | extern void bb_simple_perror_msg(const char *s) FAST_FUNC; | 15 | extern void bb_perror_msg(const char *s, ...) FAST_FUNC; |
16 | 16 | ||
17 | /* suppress gcc "no previous prototype" warning */ | 17 | /* suppress gcc "no previous prototype" warning */ |
18 | void FAST_FUNC bb_perror_nomsg(void); | 18 | void FAST_FUNC bb_perror_nomsg(void); |
19 | void FAST_FUNC bb_perror_nomsg(void) | 19 | void FAST_FUNC bb_perror_nomsg(void) |
20 | { | 20 | { |
21 | bb_simple_perror_msg(0); | 21 | bb_perror_msg(0); |
22 | } | 22 | } |
diff --git a/libbb/perror_nomsg_and_die.c b/libbb/perror_nomsg_and_die.c index bea5f25a5..543ff5178 100644 --- a/libbb/perror_nomsg_and_die.c +++ b/libbb/perror_nomsg_and_die.c | |||
@@ -12,11 +12,11 @@ | |||
12 | * instead of including libbb.h */ | 12 | * instead of including libbb.h */ |
13 | //#include "libbb.h" | 13 | //#include "libbb.h" |
14 | #include "platform.h" | 14 | #include "platform.h" |
15 | extern void bb_simple_perror_msg_and_die(const char *s) FAST_FUNC; | 15 | extern void bb_perror_msg_and_die(const char *s, ...) FAST_FUNC; |
16 | 16 | ||
17 | /* suppress gcc "no previous prototype" warning */ | 17 | /* suppress gcc "no previous prototype" warning */ |
18 | void FAST_FUNC bb_perror_nomsg_and_die(void); | 18 | void FAST_FUNC bb_perror_nomsg_and_die(void); |
19 | void FAST_FUNC bb_perror_nomsg_and_die(void) | 19 | void FAST_FUNC bb_perror_nomsg_and_die(void) |
20 | { | 20 | { |
21 | bb_simple_perror_msg_and_die(0); | 21 | bb_perror_msg_and_die(0); |
22 | } | 22 | } |
diff --git a/procps/top.c b/procps/top.c index 744f20e9b..ff775422c 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -879,8 +879,11 @@ static NOINLINE void display_topmem_process_list(int lines_rem, int scr_width) | |||
879 | lines_rem = ntop - G_scroll_ofs; | 879 | lines_rem = ntop - G_scroll_ofs; |
880 | while (--lines_rem >= 0) { | 880 | while (--lines_rem >= 0) { |
881 | /* PID VSZ VSZRW RSS (SHR) DIRTY (SHR) COMMAND */ | 881 | /* PID VSZ VSZRW RSS (SHR) DIRTY (SHR) COMMAND */ |
882 | ulltoa6_and_space(s->pid , &line_buf[0*6]); | 882 | int n = sprintf(line_buf, "%5u ", s->pid); |
883 | ulltoa6_and_space(s->vsz , &line_buf[1*6]); | 883 | ulltoa6_and_space(s->vsz , &line_buf[1*6]); |
884 | if (n > 7 || (n == 7 && line_buf[6] != ' ')) | ||
885 | /* PID and VSZ are clumped together, truncate PID */ | ||
886 | line_buf[5] = '.'; | ||
884 | ulltoa6_and_space(s->vszrw , &line_buf[2*6]); | 887 | ulltoa6_and_space(s->vszrw , &line_buf[2*6]); |
885 | ulltoa6_and_space(s->rss , &line_buf[3*6]); | 888 | ulltoa6_and_space(s->rss , &line_buf[3*6]); |
886 | ulltoa6_and_space(s->rss_sh , &line_buf[4*6]); | 889 | ulltoa6_and_space(s->rss_sh , &line_buf[4*6]); |
diff --git a/shell/ash.c b/shell/ash.c index b34ed67a7..28c7fe2db 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -10611,7 +10611,7 @@ evalpipe(union node *n, int flags) | |||
10611 | } | 10611 | } |
10612 | 10612 | ||
10613 | /* setinteractive needs this forward reference */ | 10613 | /* setinteractive needs this forward reference */ |
10614 | #if EDITING_HAS_get_exe_name | 10614 | #if ENABLE_FEATURE_EDITING |
10615 | static const char *get_builtin_name(int i) FAST_FUNC; | 10615 | static const char *get_builtin_name(int i) FAST_FUNC; |
10616 | #endif | 10616 | #endif |
10617 | 10617 | ||
@@ -10648,9 +10648,8 @@ setinteractive(int on) | |||
10648 | #if ENABLE_FEATURE_EDITING | 10648 | #if ENABLE_FEATURE_EDITING |
10649 | if (!line_input_state) { | 10649 | if (!line_input_state) { |
10650 | line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); | 10650 | line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); |
10651 | # if EDITING_HAS_get_exe_name | ||
10652 | line_input_state->get_exe_name = get_builtin_name; | 10651 | line_input_state->get_exe_name = get_builtin_name; |
10653 | # endif | 10652 | line_input_state->sh_get_var = lookupvar; |
10654 | } | 10653 | } |
10655 | #endif | 10654 | #endif |
10656 | } | 10655 | } |
@@ -11157,7 +11156,7 @@ find_builtin(const char *name) | |||
11157 | return bp; | 11156 | return bp; |
11158 | } | 11157 | } |
11159 | 11158 | ||
11160 | #if EDITING_HAS_get_exe_name | 11159 | #if ENABLE_FEATURE_EDITING |
11161 | static const char * FAST_FUNC | 11160 | static const char * FAST_FUNC |
11162 | get_builtin_name(int i) | 11161 | get_builtin_name(int i) |
11163 | { | 11162 | { |
diff --git a/shell/hush.c b/shell/hush.c index ae81f0da5..051b123e7 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -8188,7 +8188,7 @@ static const struct built_in_command *find_builtin(const char *name) | |||
8188 | return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]); | 8188 | return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]); |
8189 | } | 8189 | } |
8190 | 8190 | ||
8191 | #if ENABLE_HUSH_JOB && EDITING_HAS_get_exe_name | 8191 | #if ENABLE_HUSH_JOB && ENABLE_FEATURE_EDITING |
8192 | static const char * FAST_FUNC get_builtin_name(int i) | 8192 | static const char * FAST_FUNC get_builtin_name(int i) |
8193 | { | 8193 | { |
8194 | if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) { | 8194 | if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) { |
@@ -10668,9 +10668,8 @@ int hush_main(int argc, char **argv) | |||
10668 | 10668 | ||
10669 | # if ENABLE_FEATURE_EDITING | 10669 | # if ENABLE_FEATURE_EDITING |
10670 | G.line_input_state = new_line_input_t(FOR_SHELL); | 10670 | G.line_input_state = new_line_input_t(FOR_SHELL); |
10671 | # if EDITING_HAS_get_exe_name | ||
10672 | G.line_input_state->get_exe_name = get_builtin_name; | 10671 | G.line_input_state->get_exe_name = get_builtin_name; |
10673 | # endif | 10672 | G.line_input_state->sh_get_var = get_local_var_value; |
10674 | # endif | 10673 | # endif |
10675 | # if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0 | 10674 | # if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0 |
10676 | { | 10675 | { |