aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-11-03 14:16:08 +0000
committerRon Yorston <rmy@pobox.com>2017-11-03 14:16:08 +0000
commitd6ce08aeb85b3698ddaa281016b70e16aeb9fb35 (patch)
tree02ad9bc0684859515fe891f3d6b0a1086e0db156 /libbb
parentab450021a99ba66126cc6d668fb06ec3829a572b (diff)
parenta5060b8364faa7c677c8950f1315c451403b0660 (diff)
downloadbusybox-w32-d6ce08aeb85b3698ddaa281016b70e16aeb9fb35.tar.gz
busybox-w32-d6ce08aeb85b3698ddaa281016b70e16aeb9fb35.tar.bz2
busybox-w32-d6ce08aeb85b3698ddaa281016b70e16aeb9fb35.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c1
-rw-r--r--libbb/ask_confirmation.c3
-rw-r--r--libbb/bb_askpass.c1
-rw-r--r--libbb/bb_do_delay.c1
-rw-r--r--libbb/bb_pwd.c1
-rw-r--r--libbb/bb_qsort.c1
-rw-r--r--libbb/bb_strtod.c1
-rw-r--r--libbb/bb_strtonum.c1
-rw-r--r--libbb/bbunit.c2
-rw-r--r--libbb/change_identity.c1
-rw-r--r--libbb/chomp.c1
-rw-r--r--libbb/compare_string_array.c1
-rw-r--r--libbb/concat_path_file.c3
-rw-r--r--libbb/concat_subpath_file.c3
-rw-r--r--libbb/copyfd.c1
-rw-r--r--libbb/correct_password.c1
-rw-r--r--libbb/crc32.c1
-rw-r--r--libbb/default_error_retval.c2
-rw-r--r--libbb/device_open.c1
-rw-r--r--libbb/die_if_bad_username.c1
-rw-r--r--libbb/dump.c1
-rw-r--r--libbb/executable.c1
-rw-r--r--libbb/fclose_nonstdin.c4
-rw-r--r--libbb/fflush_stdout_and_exit.c4
-rw-r--r--libbb/fgets_str.c1
-rw-r--r--libbb/find_mount_point.c1
-rw-r--r--libbb/find_pid_by_name.c1
-rw-r--r--libbb/find_root_device.c1
-rw-r--r--libbb/full_write.c1
-rw-r--r--libbb/get_console.c1
-rw-r--r--libbb/get_line_from_file.c1
-rw-r--r--libbb/getpty.c1
-rw-r--r--libbb/hash_md5_sha.c1
-rw-r--r--libbb/human_readable.c1
-rw-r--r--libbb/in_ether.c1
-rw-r--r--libbb/inet_common.c1
-rw-r--r--libbb/inode_hash.c1
-rw-r--r--libbb/isdirectory.c2
-rw-r--r--libbb/kernel_version.c2
-rw-r--r--libbb/last_char_is.c1
-rw-r--r--libbb/lineedit.c88
-rw-r--r--libbb/llist.c1
-rw-r--r--libbb/login.c1
-rw-r--r--libbb/make_directory.c2
-rw-r--r--libbb/match_fstype.c1
-rw-r--r--libbb/messages.c1
-rw-r--r--libbb/mode_string.c8
-rw-r--r--libbb/mtab.c1
-rw-r--r--libbb/nuke_str.c1
-rw-r--r--libbb/parse_mode.c3
-rw-r--r--libbb/percent_decode.c1
-rw-r--r--libbb/print_flags.c3
-rw-r--r--libbb/printable.c1
-rw-r--r--libbb/process_escape_sequence.c1
-rw-r--r--libbb/procps.c1
-rw-r--r--libbb/ptr_to_globals.c1
-rw-r--r--libbb/pw_encrypt.c1
-rw-r--r--libbb/recursive_action.c1
-rw-r--r--libbb/remove_file.c1
-rw-r--r--libbb/replace.c1
-rw-r--r--libbb/run_shell.c1
-rw-r--r--libbb/safe_gethostname.c2
-rw-r--r--libbb/safe_poll.c1
-rw-r--r--libbb/safe_strncpy.c1
-rw-r--r--libbb/safe_write.c1
-rw-r--r--libbb/setup_environment.c1
-rw-r--r--libbb/signals.c1
-rw-r--r--libbb/skip_whitespace.c1
-rw-r--r--libbb/speed_table.c1
-rw-r--r--libbb/strrstr.c1
-rw-r--r--libbb/trim.c1
-rw-r--r--libbb/udp_io.c8
-rw-r--r--libbb/uuencode.c1
-rw-r--r--libbb/wfopen.c1
-rw-r--r--libbb/wfopen_input.c3
-rw-r--r--libbb/write.c1
-rw-r--r--libbb/xatonum.c1
-rw-r--r--libbb/xconnect.c1
-rw-r--r--libbb/xfunc_die.c3
-rw-r--r--libbb/xfuncs.c11
-rw-r--r--libbb/xfuncs_printf.c2
-rw-r--r--libbb/xgetcwd.c1
-rw-r--r--libbb/xreadlink.c1
-rw-r--r--libbb/xrealloc_vector.c1
-rw-r--r--libbb/xregcomp.c1
85 files changed, 90 insertions, 133 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 71ee0dd07..89f76443c 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -11,7 +11,6 @@
11 * 11 *
12 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13 */ 13 */
14
15/* We are trying to not use printf, this benefits the case when selected 14/* We are trying to not use printf, this benefits the case when selected
16 * applets are really simple. Example: 15 * applets are really simple. Example:
17 * 16 *
diff --git a/libbb/ask_confirmation.c b/libbb/ask_confirmation.c
index d95729cc9..6fbed89f4 100644
--- a/libbb/ask_confirmation.c
+++ b/libbb/ask_confirmation.c
@@ -6,12 +6,11 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y', 11/* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y',
11 * return 1. Otherwise return 0. 12 * return 1. Otherwise return 0.
12 */ 13 */
13#include "libbb.h"
14
15int FAST_FUNC bb_ask_confirmation(void) 14int FAST_FUNC bb_ask_confirmation(void)
16{ 15{
17 char first = 0; 16 char first = 0;
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c
index c2580b9eb..aae35ec41 100644
--- a/libbb/bb_askpass.c
+++ b/libbb/bb_askpass.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* do nothing signal handler */ 11/* do nothing signal handler */
diff --git a/libbb/bb_do_delay.c b/libbb/bb_do_delay.c
index 05c879fb9..65541704b 100644
--- a/libbb/bb_do_delay.c
+++ b/libbb/bb_do_delay.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12void FAST_FUNC bb_do_delay(int seconds) 11void FAST_FUNC bb_do_delay(int seconds)
diff --git a/libbb/bb_pwd.c b/libbb/bb_pwd.c
index dca0a150b..32ff83a42 100644
--- a/libbb/bb_pwd.c
+++ b/libbb/bb_pwd.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13/* TODO: maybe change API to return malloced data? 12/* TODO: maybe change API to return malloced data?
diff --git a/libbb/bb_qsort.c b/libbb/bb_qsort.c
index a54e7236a..505045533 100644
--- a/libbb/bb_qsort.c
+++ b/libbb/bb_qsort.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12int /* not FAST_FUNC! */ bb_pstrcmp(const void *a, const void *b) 11int /* not FAST_FUNC! */ bb_pstrcmp(const void *a, const void *b)
diff --git a/libbb/bb_strtod.c b/libbb/bb_strtod.c
index 5dde78414..5e1d0535e 100644
--- a/libbb/bb_strtod.c
+++ b/libbb/bb_strtod.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11#include <math.h> /* just for HUGE_VAL */ 10#include <math.h> /* just for HUGE_VAL */
12 11
diff --git a/libbb/bb_strtonum.c b/libbb/bb_strtonum.c
index 949f26bee..2185017b0 100644
--- a/libbb/bb_strtonum.c
+++ b/libbb/bb_strtonum.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* On exit: errno = 0 only if there was non-empty, '\0' terminated value 11/* On exit: errno = 0 only if there was non-empty, '\0' terminated value
diff --git a/libbb/bbunit.c b/libbb/bbunit.c
index db67b1081..5f8d980a3 100644
--- a/libbb/bbunit.c
+++ b/libbb/bbunit.c
@@ -6,9 +6,9 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//applet:IF_UNIT_TEST(APPLET(unit, BB_DIR_USR_BIN, BB_SUID_DROP))
9 10
10//kbuild:lib-$(CONFIG_UNIT_TEST) += bbunit.o 11//kbuild:lib-$(CONFIG_UNIT_TEST) += bbunit.o
11//applet:IF_UNIT_TEST(APPLET(unit, BB_DIR_USR_BIN, BB_SUID_DROP))
12 12
13//usage:#define unit_trivial_usage 13//usage:#define unit_trivial_usage
14//usage: "" 14//usage: ""
diff --git a/libbb/change_identity.c b/libbb/change_identity.c
index 431f72c8c..20d7c5f2d 100644
--- a/libbb/change_identity.c
+++ b/libbb/change_identity.c
@@ -27,7 +27,6 @@
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30
31#include "libbb.h" 30#include "libbb.h"
32 31
33/* Become the user and group(s) specified by PW. */ 32/* Become the user and group(s) specified by PW. */
diff --git a/libbb/chomp.c b/libbb/chomp.c
index cb92befb1..3757bff2e 100644
--- a/libbb/chomp.c
+++ b/libbb/chomp.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13void FAST_FUNC chomp(char *s) 12void FAST_FUNC chomp(char *s)
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c
index 2f51237a3..01a9df0e2 100644
--- a/libbb/compare_string_array.c
+++ b/libbb/compare_string_array.c
@@ -2,7 +2,6 @@
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5
6#include "libbb.h" 5#include "libbb.h"
7 6
8/* 7/*
diff --git a/libbb/concat_path_file.c b/libbb/concat_path_file.c
index 9ed295996..5b4b7f113 100644
--- a/libbb/concat_path_file.c
+++ b/libbb/concat_path_file.c
@@ -7,6 +7,7 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h"
10 11
11/* Concatenate path and filename to new allocated buffer. 12/* Concatenate path and filename to new allocated buffer.
12 * Add '/' only as needed (no duplicate // are produced). 13 * Add '/' only as needed (no duplicate // are produced).
@@ -14,8 +15,6 @@
14 * filename should not be NULL. 15 * filename should not be NULL.
15 */ 16 */
16 17
17#include "libbb.h"
18
19char* FAST_FUNC concat_path_file(const char *path, const char *filename) 18char* FAST_FUNC concat_path_file(const char *path, const char *filename)
20{ 19{
21 char *lc; 20 char *lc;
diff --git a/libbb/concat_subpath_file.c b/libbb/concat_subpath_file.c
index c9167d492..bc2ee96ca 100644
--- a/libbb/concat_subpath_file.c
+++ b/libbb/concat_subpath_file.c
@@ -6,6 +6,7 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* 11/*
11 This function make special for recursive actions with usage 12 This function make special for recursive actions with usage
@@ -13,8 +14,6 @@
13 and skipping "." and ".." directory entries 14 and skipping "." and ".." directory entries
14*/ 15*/
15 16
16#include "libbb.h"
17
18char* FAST_FUNC concat_subpath_file(const char *path, const char *f) 17char* FAST_FUNC concat_subpath_file(const char *path, const char *f)
19{ 18{
20 if (f && DOT_OR_DOTDOT(f)) 19 if (f && DOT_OR_DOTDOT(f))
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index 921fe3f81..dd0517cd6 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11#if ENABLE_FEATURE_USE_SENDFILE 10#if ENABLE_FEATURE_USE_SENDFILE
12# include <sys/sendfile.h> 11# include <sys/sendfile.h>
diff --git a/libbb/correct_password.c b/libbb/correct_password.c
index 51928f68d..a6f7d9b3d 100644
--- a/libbb/correct_password.c
+++ b/libbb/correct_password.c
@@ -27,7 +27,6 @@
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30
31#include "libbb.h" 30#include "libbb.h"
32 31
33#define SHADOW_BUFSIZE 256 32#define SHADOW_BUFSIZE 256
diff --git a/libbb/crc32.c b/libbb/crc32.c
index 0711ca84e..b00b580d0 100644
--- a/libbb/crc32.c
+++ b/libbb/crc32.c
@@ -15,7 +15,6 @@
15 * 15 *
16 * Licensed under GPLv2, see file LICENSE in this source tree. 16 * Licensed under GPLv2, see file LICENSE in this source tree.
17 */ 17 */
18
19#include "libbb.h" 18#include "libbb.h"
20 19
21uint32_t *global_crc32_table; 20uint32_t *global_crc32_table;
diff --git a/libbb/default_error_retval.c b/libbb/default_error_retval.c
index 4f6395fa2..fc6a5364a 100644
--- a/libbb/default_error_retval.c
+++ b/libbb/default_error_retval.c
@@ -4,7 +4,6 @@
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7
8/* Seems silly to copyright a global variable. ;-) Oh well. 7/* Seems silly to copyright a global variable. ;-) Oh well.
9 * 8 *
10 * At least one applet (cmp) returns a value different from the typical 9 * At least one applet (cmp) returns a value different from the typical
@@ -12,7 +11,6 @@
12 * by the applet. I suppose we could use a wrapper function to set it, but 11 * by the applet. I suppose we could use a wrapper function to set it, but
13 * that too seems silly. 12 * that too seems silly.
14 */ 13 */
15
16#include "libbb.h" 14#include "libbb.h"
17 15
18uint8_t xfunc_error_retval = EXIT_FAILURE; 16uint8_t xfunc_error_retval = EXIT_FAILURE;
diff --git a/libbb/device_open.c b/libbb/device_open.c
index a8fe2fcb4..e5639c712 100644
--- a/libbb/device_open.c
+++ b/libbb/device_open.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* try to open up the specified device */ 11/* try to open up the specified device */
diff --git a/libbb/die_if_bad_username.c b/libbb/die_if_bad_username.c
index cf1297bd6..46f103340 100644
--- a/libbb/die_if_bad_username.c
+++ b/libbb/die_if_bad_username.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* To avoid problems, the username should consist only of 11/* To avoid problems, the username should consist only of
diff --git a/libbb/dump.c b/libbb/dump.c
index e23b71294..db91fcfe7 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -10,7 +10,6 @@
10 * 10 *
11 * Original copyright notice is retained at the end of this file. 11 * Original copyright notice is retained at the end of this file.
12 */ 12 */
13
14#include "libbb.h" 13#include "libbb.h"
15#include "dump.h" 14#include "dump.h"
16 15
diff --git a/libbb/executable.c b/libbb/executable.c
index 5f0ff8c6e..b28f020e0 100644
--- a/libbb/executable.c
+++ b/libbb/executable.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* check if path points to an executable file; 11/* check if path points to an executable file;
diff --git a/libbb/fclose_nonstdin.c b/libbb/fclose_nonstdin.c
index 1b1441347..7d5331063 100644
--- a/libbb/fclose_nonstdin.c
+++ b/libbb/fclose_nonstdin.c
@@ -6,14 +6,12 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* A number of standard utilities can accept multiple command line args 11/* A number of standard utilities can accept multiple command line args
11 * of '-' for stdin, according to SUSv3. So we encapsulate the check 12 * of '-' for stdin, according to SUSv3. So we encapsulate the check
12 * here to save a little space. 13 * here to save a little space.
13 */ 14 */
14
15#include "libbb.h"
16
17int FAST_FUNC fclose_if_not_stdin(FILE *f) 15int FAST_FUNC fclose_if_not_stdin(FILE *f)
18{ 16{
19 /* Some more paranoid applets want ferror() check too */ 17 /* Some more paranoid applets want ferror() check too */
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c
index b4bed865f..4c689c0fb 100644
--- a/libbb/fflush_stdout_and_exit.c
+++ b/libbb/fflush_stdout_and_exit.c
@@ -6,13 +6,11 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* Attempt to fflush(stdout), and exit with an error code if stdout is 11/* Attempt to fflush(stdout), and exit with an error code if stdout is
11 * in an error state. 12 * in an error state.
12 */ 13 */
13
14#include "libbb.h"
15
16void FAST_FUNC fflush_stdout_and_exit(int retval) 14void FAST_FUNC fflush_stdout_and_exit(int retval)
17{ 15{
18 xfunc_error_retval = retval; 16 xfunc_error_retval = retval;
diff --git a/libbb/fgets_str.c b/libbb/fgets_str.c
index 89210a3c9..1a7f2e9e0 100644
--- a/libbb/fgets_str.c
+++ b/libbb/fgets_str.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13static char *xmalloc_fgets_internal(FILE *file, const char *terminating_string, int chop_off, size_t *maxsz_p) 12static char *xmalloc_fgets_internal(FILE *file, const char *terminating_string, int chop_off, size_t *maxsz_p)
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c
index 1308d9b65..341c30102 100644
--- a/libbb/find_mount_point.c
+++ b/libbb/find_mount_point.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11#include <mntent.h> 10#include <mntent.h>
12 11
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c
index 22afa1ce5..52debb171 100644
--- a/libbb/find_pid_by_name.c
+++ b/libbb/find_pid_by_name.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* 11/*
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c
index 8436cd664..d560f3ec3 100644
--- a/libbb/find_root_device.c
+++ b/libbb/find_root_device.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Find block device /dev/XXX which contains specified file 11/* Find block device /dev/XXX which contains specified file
diff --git a/libbb/full_write.c b/libbb/full_write.c
index 777fbd910..2b7983f4c 100644
--- a/libbb/full_write.c
+++ b/libbb/full_write.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* 11/*
diff --git a/libbb/get_console.c b/libbb/get_console.c
index 96b339ca7..0b53524aa 100644
--- a/libbb/get_console.c
+++ b/libbb/get_console.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13/* From <linux/kd.h> */ 12/* From <linux/kd.h> */
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index 2038fac7d..4e09ddc80 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11
12#include "libbb.h" 11#include "libbb.h"
13 12
14char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int *end) 13char* FAST_FUNC bb_get_chunk_from_file(FILE *file, int *end)
diff --git a/libbb/getpty.c b/libbb/getpty.c
index 391d729f2..5d24ca930 100644
--- a/libbb/getpty.c
+++ b/libbb/getpty.c
@@ -5,7 +5,6 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8
9#include "libbb.h" 8#include "libbb.h"
10 9
11#define DEBUG 0 10#define DEBUG 0
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
index 2a7247430..a53a382ce 100644
--- a/libbb/hash_md5_sha.c
+++ b/libbb/hash_md5_sha.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12#define NEED_SHA512 (ENABLE_SHA512SUM || ENABLE_USE_BB_CRYPT_SHA) 11#define NEED_SHA512 (ENABLE_SHA512SUM || ENABLE_USE_BB_CRYPT_SHA)
diff --git a/libbb/human_readable.c b/libbb/human_readable.c
index b4e0ef181..09221a186 100644
--- a/libbb/human_readable.c
+++ b/libbb/human_readable.c
@@ -22,7 +22,6 @@
22 * 22 *
23 * Licensed under GPLv2, see file LICENSE in this source tree. 23 * Licensed under GPLv2, see file LICENSE in this source tree.
24 */ 24 */
25
26#include "libbb.h" 25#include "libbb.h"
27 26
28const char* FAST_FUNC make_human_readable_str(unsigned long long val, 27const char* FAST_FUNC make_human_readable_str(unsigned long long val,
diff --git a/libbb/in_ether.c b/libbb/in_ether.c
index 161c8ea3c..c9cf6a99b 100644
--- a/libbb/in_ether.c
+++ b/libbb/in_ether.c
@@ -2,7 +2,6 @@
2/* 2/*
3 * Utility routines. 3 * Utility routines.
4 */ 4 */
5
6//kbuild:lib-$(CONFIG_ARP) += in_ether.o 5//kbuild:lib-$(CONFIG_ARP) += in_ether.o
7//kbuild:lib-$(CONFIG_IFCONFIG) += in_ether.o 6//kbuild:lib-$(CONFIG_IFCONFIG) += in_ether.o
8//kbuild:lib-$(CONFIG_IFENSLAVE) += in_ether.o 7//kbuild:lib-$(CONFIG_IFENSLAVE) += in_ether.o
diff --git a/libbb/inet_common.c b/libbb/inet_common.c
index 04259f47b..e9fbde7dc 100644
--- a/libbb/inet_common.c
+++ b/libbb/inet_common.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12#include "inet_common.h" 11#include "inet_common.h"
13 12
diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c
index bfed6567c..770d1a286 100644
--- a/libbb/inode_hash.c
+++ b/libbb/inode_hash.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13typedef struct ino_dev_hash_bucket_struct { 12typedef struct ino_dev_hash_bucket_struct {
diff --git a/libbb/isdirectory.c b/libbb/isdirectory.c
index ba6c52ce8..6225a34b2 100644
--- a/libbb/isdirectory.c
+++ b/libbb/isdirectory.c
@@ -7,8 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include <sys/stat.h>
12#include "libbb.h" 10#include "libbb.h"
13 11
14/* 12/*
diff --git a/libbb/kernel_version.c b/libbb/kernel_version.c
index 9b6c62299..7769a091b 100644
--- a/libbb/kernel_version.c
+++ b/libbb/kernel_version.c
@@ -6,12 +6,10 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11/* After libbb.h, since it needs sys/types.h on some systems */ 10/* After libbb.h, since it needs sys/types.h on some systems */
12#include <sys/utsname.h> /* for uname(2) */ 11#include <sys/utsname.h> /* for uname(2) */
13 12
14
15/* Returns current kernel version encoded as major*65536 + minor*256 + patch, 13/* Returns current kernel version encoded as major*65536 + minor*256 + patch,
16 * so, for example, to check if the kernel is greater than 2.2.11: 14 * so, for example, to check if the kernel is greater than 2.2.11:
17 * 15 *
diff --git a/libbb/last_char_is.c b/libbb/last_char_is.c
index 65e6cdf04..66f2e3635 100644
--- a/libbb/last_char_is.c
+++ b/libbb/last_char_is.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Find out if the last character of a string matches the one given. 11/* Find out if the last character of a string matches the one given.
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index d85057e72..c0edb7399 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -37,11 +37,6 @@
37 * 37 *
38 * Unicode in PS1 is not fully supported: prompt length calulation is wrong, 38 * Unicode in PS1 is not fully supported: prompt length calulation is wrong,
39 * resulting in line wrap problems with long (multi-line) input. 39 * resulting in line wrap problems with long (multi-line) input.
40 *
41 * Multi-line PS1 (e.g. PS1="\n[\w]\n$ ") has problems with history
42 * browsing: up/down arrows result in scrolling.
43 * It stems from simplistic "cmdedit_y = cmdedit_prmt_len / cmdedit_termw"
44 * calculation of how many lines the prompt takes.
45 */ 40 */
46#include "busybox.h" 41#include "busybox.h"
47#include "NUM_APPLETS.h" 42#include "NUM_APPLETS.h"
@@ -133,7 +128,7 @@ struct lineedit_statics {
133 128
134 unsigned cmdedit_x; /* real x (col) terminal position */ 129 unsigned cmdedit_x; /* real x (col) terminal position */
135 unsigned cmdedit_y; /* pseudoreal y (row) terminal position */ 130 unsigned cmdedit_y; /* pseudoreal y (row) terminal position */
136 unsigned cmdedit_prmt_len; /* length of prompt (without colors etc) */ 131 unsigned cmdedit_prmt_len; /* on-screen length of last/sole prompt line */
137 132
138 unsigned cursor; 133 unsigned cursor;
139 int command_len; /* must be signed */ 134 int command_len; /* must be signed */
@@ -143,6 +138,7 @@ struct lineedit_statics {
143 CHAR_T *command_ps; 138 CHAR_T *command_ps;
144 139
145 const char *cmdedit_prompt; 140 const char *cmdedit_prompt;
141 const char *prompt_last_line; /* last/sole prompt line */
146 142
147#if ENABLE_USERNAME_OR_HOMEDIR 143#if ENABLE_USERNAME_OR_HOMEDIR
148 char *user_buf; 144 char *user_buf;
@@ -185,6 +181,7 @@ extern struct lineedit_statics *const lineedit_ptr_to_statics;
185#define command_len (S.command_len ) 181#define command_len (S.command_len )
186#define command_ps (S.command_ps ) 182#define command_ps (S.command_ps )
187#define cmdedit_prompt (S.cmdedit_prompt ) 183#define cmdedit_prompt (S.cmdedit_prompt )
184#define prompt_last_line (S.prompt_last_line)
188#define user_buf (S.user_buf ) 185#define user_buf (S.user_buf )
189#define home_pwd_buf (S.home_pwd_buf ) 186#define home_pwd_buf (S.home_pwd_buf )
190#define matches (S.matches ) 187#define matches (S.matches )
@@ -473,14 +470,20 @@ static void beep(void)
473 bb_putchar('\007'); 470 bb_putchar('\007');
474} 471}
475 472
476static void put_prompt(void) 473/* Full or last/sole prompt line, reset edit cursor, calculate terminal cursor.
474 * cmdedit_y is always calculated for the last/sole prompt line.
475 */
476static void put_prompt_custom(bool is_full)
477{ 477{
478 fputs(cmdedit_prompt, stdout); 478 fputs((is_full ? cmdedit_prompt : prompt_last_line), stdout);
479 cursor = 0; 479 cursor = 0;
480 cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */ 480 cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */
481 cmdedit_x = cmdedit_prmt_len % cmdedit_termw; 481 cmdedit_x = cmdedit_prmt_len % cmdedit_termw;
482} 482}
483 483
484#define put_prompt_last_line() put_prompt_custom(0)
485#define put_prompt() put_prompt_custom(1)
486
484/* Move back one character */ 487/* Move back one character */
485/* (optimized for slow terminals) */ 488/* (optimized for slow terminals) */
486static void input_backward(unsigned num) 489static void input_backward(unsigned num)
@@ -547,7 +550,7 @@ static void input_backward(unsigned num)
547 printf("\r" ESC"[%uA", cmdedit_y); 550 printf("\r" ESC"[%uA", cmdedit_y);
548 cmdedit_y = 0; 551 cmdedit_y = 0;
549 sv_cursor = cursor; 552 sv_cursor = cursor;
550 put_prompt(); /* sets cursor to 0 */ 553 put_prompt_last_line(); /* sets cursor to 0 */
551 while (cursor < sv_cursor) 554 while (cursor < sv_cursor)
552 put_cur_glyph_and_inc_cursor(); 555 put_cur_glyph_and_inc_cursor();
553 } else { 556 } else {
@@ -568,18 +571,27 @@ static void input_backward(unsigned num)
568 } 571 }
569} 572}
570 573
571/* draw prompt, editor line, and clear tail */ 574/* See redraw and draw_full below */
572static void redraw(int y, int back_cursor) 575static void draw_custom(int y, int back_cursor, bool is_full)
573{ 576{
574 if (y > 0) /* up y lines */ 577 if (y > 0) /* up y lines */
575 printf(ESC"[%uA", y); 578 printf(ESC"[%uA", y);
576 bb_putchar('\r'); 579 bb_putchar('\r');
577 put_prompt(); 580 put_prompt_custom(is_full);
578 put_till_end_and_adv_cursor(); 581 put_till_end_and_adv_cursor();
579 printf(SEQ_CLEAR_TILL_END_OF_SCREEN); 582 printf(SEQ_CLEAR_TILL_END_OF_SCREEN);
580 input_backward(back_cursor); 583 input_backward(back_cursor);
581} 584}
582 585
586/* Move y lines up, draw last/sole prompt line, editor line[s], and clear tail.
587 * goal: redraw the prompt+input+cursor in-place, overwriting the previous */
588#define redraw(y, back_cursor) draw_custom((y), (back_cursor), 0)
589
590/* Like above, but without moving up, and while using all the prompt lines.
591 * goal: draw a full prompt+input+cursor unrelated to a previous position.
592 * note: cmdedit_y always ends up relating to the last/sole prompt line */
593#define draw_full(back_cursor) draw_custom(0, (back_cursor), 1)
594
583/* Delete the char in front of the cursor, optionally saving it 595/* Delete the char in front of the cursor, optionally saving it
584 * for later putback */ 596 * for later putback */
585#if !ENABLE_FEATURE_EDITING_VI 597#if !ENABLE_FEATURE_EDITING_VI
@@ -1159,7 +1171,7 @@ static NOINLINE void input_tab(smallint *lastWasTab)
1159 int sav_cursor = cursor; 1171 int sav_cursor = cursor;
1160 goto_new_line(); 1172 goto_new_line();
1161 showfiles(); 1173 showfiles();
1162 redraw(0, command_len - sav_cursor); 1174 draw_full(command_len - sav_cursor);
1163 } 1175 }
1164 return; 1176 return;
1165 } 1177 }
@@ -1835,14 +1847,37 @@ static void ask_terminal(void)
1835#define ask_terminal() ((void)0) 1847#define ask_terminal() ((void)0)
1836#endif 1848#endif
1837 1849
1850/* Note about multi-line PS1 (e.g. "\n\w \u@\h\n> ") and prompt redrawing:
1851 *
1852 * If the prompt has any newlines, after we print it once we use only its last
1853 * line to redraw in-place, which makes it simpler to calculate how many lines
1854 * we should move the cursor up to align the redraw (cmdedit_y). The earlier
1855 * prompt lines just stay on screen and we redraw below them.
1856 *
1857 * Use cases for all prompt lines beyond the initial draw:
1858 * - After clear-screen (^L) or after displaying tab-completion choices, we
1859 * print the full prompt, as it isn't redrawn in-place.
1860 * - During terminal resize we could try to redraw all lines, but we don't,
1861 * because it requires delicate alignment, it's good enough with only the
1862 * last line, and doing it wrong is arguably worse than not doing it at all.
1863 *
1864 * Terminology wise, if it doesn't mention "full", then it means the last/sole
1865 * prompt line. We use the prompt (last/sole line) while redrawing in-place,
1866 * and the full where we need a fresh one unrelated to an earlier position.
1867 *
1868 * If PS1 is not multiline, the last/sole line and the full are the same string.
1869 */
1870
1838/* Called just once at read_line_input() init time */ 1871/* Called just once at read_line_input() init time */
1839#if !ENABLE_FEATURE_EDITING_FANCY_PROMPT 1872#if !ENABLE_FEATURE_EDITING_FANCY_PROMPT
1840static void parse_and_put_prompt(const char *prmt_ptr) 1873static void parse_and_put_prompt(const char *prmt_ptr)
1841{ 1874{
1842 const char *p; 1875 const char *p;
1843 cmdedit_prompt = prmt_ptr; 1876 cmdedit_prompt = prompt_last_line = prmt_ptr;
1844 p = strrchr(prmt_ptr, '\n'); 1877 p = strrchr(prmt_ptr, '\n');
1845 cmdedit_prmt_len = unicode_strwidth(p ? p+1 : prmt_ptr); 1878 if (p)
1879 prompt_last_line = p + 1;
1880 cmdedit_prmt_len = unicode_strwidth(prompt_last_line);
1846 put_prompt(); 1881 put_prompt();
1847} 1882}
1848#else 1883#else
@@ -2035,7 +2070,11 @@ static void parse_and_put_prompt(const char *prmt_ptr)
2035 if (cwd_buf != (char *)bb_msg_unknown) 2070 if (cwd_buf != (char *)bb_msg_unknown)
2036 free(cwd_buf); 2071 free(cwd_buf);
2037# endif 2072# endif
2038 cmdedit_prompt = prmt_mem_ptr; 2073 /* see comment (above this function) about multiline prompt redrawing */
2074 cmdedit_prompt = prompt_last_line = prmt_mem_ptr;
2075 prmt_ptr = strrchr(cmdedit_prompt, '\n');
2076 if (prmt_ptr)
2077 prompt_last_line = prmt_ptr + 1;
2039 put_prompt(); 2078 put_prompt();
2040} 2079}
2041#endif 2080#endif
@@ -2207,7 +2246,7 @@ static int32_t reverse_i_search(int timeout)
2207 match_buf[0] = '\0'; 2246 match_buf[0] = '\0';
2208 2247
2209 /* Save and replace the prompt */ 2248 /* Save and replace the prompt */
2210 saved_prompt = cmdedit_prompt; 2249 saved_prompt = prompt_last_line;
2211 saved_prmt_len = cmdedit_prmt_len; 2250 saved_prmt_len = cmdedit_prmt_len;
2212 goto set_prompt; 2251 goto set_prompt;
2213 2252
@@ -2280,10 +2319,10 @@ static int32_t reverse_i_search(int timeout)
2280 cursor = match - matched_history_line; 2319 cursor = match - matched_history_line;
2281//FIXME: cursor position for Unicode case 2320//FIXME: cursor position for Unicode case
2282 2321
2283 free((char*)cmdedit_prompt); 2322 free((char*)prompt_last_line);
2284 set_prompt: 2323 set_prompt:
2285 cmdedit_prompt = xasprintf("(reverse-i-search)'%s': ", match_buf); 2324 prompt_last_line = xasprintf("(reverse-i-search)'%s': ", match_buf);
2286 cmdedit_prmt_len = unicode_strwidth(cmdedit_prompt); 2325 cmdedit_prmt_len = unicode_strwidth(prompt_last_line);
2287 goto do_redraw; 2326 goto do_redraw;
2288 } 2327 }
2289 } 2328 }
@@ -2303,8 +2342,8 @@ static int32_t reverse_i_search(int timeout)
2303 if (matched_history_line) 2342 if (matched_history_line)
2304 command_len = load_string(matched_history_line); 2343 command_len = load_string(matched_history_line);
2305 2344
2306 free((char*)cmdedit_prompt); 2345 free((char*)prompt_last_line);
2307 cmdedit_prompt = saved_prompt; 2346 prompt_last_line = saved_prompt;
2308 cmdedit_prmt_len = saved_prmt_len; 2347 cmdedit_prmt_len = saved_prmt_len;
2309 redraw(cmdedit_y, command_len - cursor); 2348 redraw(cmdedit_y, command_len - cursor);
2310 2349
@@ -2524,8 +2563,9 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2524 case CTRL('L'): 2563 case CTRL('L'):
2525 vi_case(CTRL('L')|VI_CMDMODE_BIT:) 2564 vi_case(CTRL('L')|VI_CMDMODE_BIT:)
2526 /* Control-l -- clear screen */ 2565 /* Control-l -- clear screen */
2527 printf(ESC"[H"); /* cursor to top,left */ 2566 /* cursor to top,left; clear to the end of screen */
2528 redraw(0, command_len - cursor); 2567 printf(ESC"[H" ESC"[J");
2568 draw_full(command_len - cursor);
2529 break; 2569 break;
2530#if MAX_HISTORY > 0 2570#if MAX_HISTORY > 0
2531 case CTRL('N'): 2571 case CTRL('N'):
diff --git a/libbb/llist.c b/libbb/llist.c
index 032e9fac8..e964a9b72 100644
--- a/libbb/llist.c
+++ b/libbb/llist.c
@@ -9,7 +9,6 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12
13#include "libbb.h" 12#include "libbb.h"
14 13
15/* Add data to the start of the linked list. */ 14/* Add data to the start of the linked list. */
diff --git a/libbb/login.c b/libbb/login.c
index 5a7acfcf0..7f593d80d 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11
12#include "libbb.h" 11#include "libbb.h"
13/* After libbb.h, since it needs sys/types.h on some systems */ 12/* After libbb.h, since it needs sys/types.h on some systems */
14#include <sys/utsname.h> 13#include <sys/utsname.h>
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index 3e171ff02..6422c863f 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* Mar 5, 2003 Manuel Novoa III 9/* Mar 5, 2003 Manuel Novoa III
11 * 10 *
12 * This is the main work function for the 'mkdir' applet. As such, it 11 * This is the main work function for the 'mkdir' applet. As such, it
@@ -21,7 +20,6 @@
21 * To set specific permissions on 'path', pass the appropriate 'mode' 20 * To set specific permissions on 'path', pass the appropriate 'mode'
22 * val. Otherwise, pass -1 to get default permissions. 21 * val. Otherwise, pass -1 to get default permissions.
23 */ 22 */
24
25#include "libbb.h" 23#include "libbb.h"
26 24
27/* This function is used from NOFORK applets. It must not allocate anything */ 25/* This function is used from NOFORK applets. It must not allocate anything */
diff --git a/libbb/match_fstype.c b/libbb/match_fstype.c
index 6046bc6db..1e2269c5e 100644
--- a/libbb/match_fstype.c
+++ b/libbb/match_fstype.c
@@ -9,7 +9,6 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12
13#include "libbb.h" 12#include "libbb.h"
14 13
15int FAST_FUNC fstype_matches(const char *fstype, const char *comma_list) 14int FAST_FUNC fstype_matches(const char *fstype, const char *comma_list)
diff --git a/libbb/messages.c b/libbb/messages.c
index 3c0b921cf..31721a3b3 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -4,7 +4,6 @@
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7
8#include "libbb.h" 7#include "libbb.h"
9 8
10/* allow default system PATH to be extended via CFLAGS */ 9/* allow default system PATH to be extended via CFLAGS */
diff --git a/libbb/mode_string.c b/libbb/mode_string.c
index c387b42cb..6c5c08acd 100644
--- a/libbb/mode_string.c
+++ b/libbb/mode_string.c
@@ -6,15 +6,7 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* Aug 13, 2003
11 * Fix a bug reported by junkio@cox.net involving the mode_chars index.
12 */
13
14
15#include <assert.h> 9#include <assert.h>
16#include <sys/stat.h>
17
18#include "libbb.h" 10#include "libbb.h"
19 11
20#if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \ 12#if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \
diff --git a/libbb/mtab.c b/libbb/mtab.c
index 22bff6490..131705ddb 100644
--- a/libbb/mtab.c
+++ b/libbb/mtab.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include <mntent.h> 9#include <mntent.h>
11#include "libbb.h" 10#include "libbb.h"
12 11
diff --git a/libbb/nuke_str.c b/libbb/nuke_str.c
index 56b808bc7..240e68004 100644
--- a/libbb/nuke_str.c
+++ b/libbb/nuke_str.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10//kbuild:lib-y += nuke_str.o 9//kbuild:lib-y += nuke_str.o
11 10
12#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c
index bddd39bca..dc65860f6 100644
--- a/libbb/parse_mode.c
+++ b/libbb/parse_mode.c
@@ -6,11 +6,10 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */
11 12
12#include "libbb.h"
13
14/* This function is used from NOFORK applets. It must not allocate anything */ 13/* This function is used from NOFORK applets. It must not allocate anything */
15 14
16#define FILEMODEBITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) 15#define FILEMODEBITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
diff --git a/libbb/percent_decode.c b/libbb/percent_decode.c
index 9a9d80c4a..e5e42f0b5 100644
--- a/libbb/percent_decode.c
+++ b/libbb/percent_decode.c
@@ -2,7 +2,6 @@
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5
6//kbuild:lib-y += percent_decode.o 5//kbuild:lib-y += percent_decode.o
7 6
8#include "libbb.h" 7#include "libbb.h"
diff --git a/libbb/print_flags.c b/libbb/print_flags.c
index eaec731e5..0ebe842be 100644
--- a/libbb/print_flags.c
+++ b/libbb/print_flags.c
@@ -1,5 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Print string that matches bit masked flags 2/*
3 * Print string that matches bit masked flags
3 * 4 *
4 * Copyright (C) 2008 Natanael Copa <natanael.copa@gmail.com> 5 * Copyright (C) 2008 Natanael Copa <natanael.copa@gmail.com>
5 * 6 *
diff --git a/libbb/printable.c b/libbb/printable.c
index 9a423431e..224dde406 100644
--- a/libbb/printable.c
+++ b/libbb/printable.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12void FAST_FUNC fputc_printable(int ch, FILE *file) 11void FAST_FUNC fputc_printable(int ch, FILE *file)
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c
index 346ecfa1e..59d0d3ea8 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13#define WANT_HEX_ESCAPES 1 12#define WANT_HEX_ESCAPES 1
diff --git a/libbb/procps.c b/libbb/procps.c
index 6f971a116..2484ab2d9 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11
12#include "libbb.h" 11#include "libbb.h"
13 12
14 13
diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c
index 1074538f3..8ba9cd154 100644
--- a/libbb/ptr_to_globals.c
+++ b/libbb/ptr_to_globals.c
@@ -4,7 +4,6 @@
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7
8#include <errno.h> 7#include <errno.h>
9 8
10struct globals; 9struct globals;
diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c
index fe06a8fe6..1edf4b6f0 100644
--- a/libbb/pw_encrypt.c
+++ b/libbb/pw_encrypt.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* static const uint8_t ascii64[] ALIGN1 = 11/* static const uint8_t ascii64[] ALIGN1 =
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c
index 8f2b8b932..0831ecc3a 100644
--- a/libbb/recursive_action.c
+++ b/libbb/recursive_action.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12#undef DEBUG_RECURS_ACTION 11#undef DEBUG_RECURS_ACTION
diff --git a/libbb/remove_file.c b/libbb/remove_file.c
index eaca293d9..8a1324393 100644
--- a/libbb/remove_file.c
+++ b/libbb/remove_file.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Used from NOFORK applets. Must not allocate anything */ 11/* Used from NOFORK applets. Must not allocate anything */
diff --git a/libbb/replace.c b/libbb/replace.c
index 8711f957d..a661d96e6 100644
--- a/libbb/replace.c
+++ b/libbb/replace.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//kbuild:lib-y += replace.o 9//kbuild:lib-y += replace.o
11 10
12#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 3bb58bb6f..a0420d982 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -27,7 +27,6 @@
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30
31#include "libbb.h" 30#include "libbb.h"
32#if ENABLE_SELINUX 31#if ENABLE_SELINUX
33#include <selinux/selinux.h> /* for setexeccon */ 32#include <selinux/selinux.h> /* for setexeccon */
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c
index cac99ae03..b22e30ea3 100644
--- a/libbb/safe_gethostname.c
+++ b/libbb/safe_gethostname.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* 9/*
11 * SUSv2 guarantees that "Host names are limited to 255 bytes" 10 * SUSv2 guarantees that "Host names are limited to 255 bytes"
12 * POSIX.1-2001 guarantees that "Host names (not including the terminating 11 * POSIX.1-2001 guarantees that "Host names (not including the terminating
@@ -23,7 +22,6 @@
23 * Host software MUST handle host names of up to 63 characters and 22 * Host software MUST handle host names of up to 63 characters and
24 * SHOULD handle host names of up to 255 characters. 23 * SHOULD handle host names of up to 255 characters.
25 */ 24 */
26
27#include "libbb.h" 25#include "libbb.h"
28#include <sys/utsname.h> 26#include <sys/utsname.h>
29 27
diff --git a/libbb/safe_poll.c b/libbb/safe_poll.c
index b492a8151..cf93a9774 100644
--- a/libbb/safe_poll.c
+++ b/libbb/safe_poll.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Wrapper which restarts poll on EINTR or ENOMEM. 11/* Wrapper which restarts poll on EINTR or ENOMEM.
diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c
index 5eb0db0bd..9570aacd7 100644
--- a/libbb/safe_strncpy.c
+++ b/libbb/safe_strncpy.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Like strncpy but make sure the resulting string is always 0 terminated. */ 11/* Like strncpy but make sure the resulting string is always 0 terminated. */
diff --git a/libbb/safe_write.c b/libbb/safe_write.c
index aad50f5e0..12bb438b7 100644
--- a/libbb/safe_write.c
+++ b/libbb/safe_write.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count) 11ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count)
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c
index 7ac22cd92..c583206f0 100644
--- a/libbb/setup_environment.c
+++ b/libbb/setup_environment.c
@@ -27,7 +27,6 @@
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30
31#include "libbb.h" 30#include "libbb.h"
32 31
33#if ENABLE_PLATFORM_MINGW32 32#if ENABLE_PLATFORM_MINGW32
diff --git a/libbb/signals.c b/libbb/signals.c
index 56512473a..3f589321c 100644
--- a/libbb/signals.c
+++ b/libbb/signals.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11
12#include "libbb.h" 11#include "libbb.h"
13 12
14/* All known arches use small ints for signals */ 13/* All known arches use small ints for signals */
diff --git a/libbb/skip_whitespace.c b/libbb/skip_whitespace.c
index b6cfbba4d..4df5d9e4d 100644
--- a/libbb/skip_whitespace.c
+++ b/libbb/skip_whitespace.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12char* FAST_FUNC skip_whitespace(const char *s) 11char* FAST_FUNC skip_whitespace(const char *s)
diff --git a/libbb/speed_table.c b/libbb/speed_table.c
index 11ced01d0..967cf8de8 100644
--- a/libbb/speed_table.c
+++ b/libbb/speed_table.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12struct speed_map { 11struct speed_map {
diff --git a/libbb/strrstr.c b/libbb/strrstr.c
index 93d970a1b..a173b034f 100644
--- a/libbb/strrstr.c
+++ b/libbb/strrstr.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* 11/*
diff --git a/libbb/trim.c b/libbb/trim.c
index e47fec74e..e360ba138 100644
--- a/libbb/trim.c
+++ b/libbb/trim.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12 11
13char* FAST_FUNC trim(char *s) 12char* FAST_FUNC trim(char *s)
diff --git a/libbb/udp_io.c b/libbb/udp_io.c
index 6e3ef484e..68355e6c4 100644
--- a/libbb/udp_io.c
+++ b/libbb/udp_io.c
@@ -8,6 +8,10 @@
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
11#if defined(IPV6_PKTINFO) && !defined(IPV6_RECVPKTINFO)
12# define IPV6_RECVPKTINFO IPV6_PKTINFO
13#endif
14
11/* 15/*
12 * This asks kernel to let us know dst addr/port of incoming packets 16 * This asks kernel to let us know dst addr/port of incoming packets
13 * We don't check for errors here. Not supported == won't be used 17 * We don't check for errors here. Not supported == won't be used
@@ -18,8 +22,8 @@ socket_want_pktinfo(int fd UNUSED_PARAM)
18#ifdef IP_PKTINFO 22#ifdef IP_PKTINFO
19 setsockopt_1(fd, IPPROTO_IP, IP_PKTINFO); 23 setsockopt_1(fd, IPPROTO_IP, IP_PKTINFO);
20#endif 24#endif
21#if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO) 25#if ENABLE_FEATURE_IPV6 && defined(IPV6_RECVPKTINFO)
22 setsockopt_1(fd, IPPROTO_IPV6, IPV6_PKTINFO); 26 setsockopt_1(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO);
23#endif 27#endif
24} 28}
25 29
diff --git a/libbb/uuencode.c b/libbb/uuencode.c
index f7b248492..f32a3da7d 100644
--- a/libbb/uuencode.c
+++ b/libbb/uuencode.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Conversion table. for base 64 */ 11/* Conversion table. for base 64 */
diff --git a/libbb/wfopen.c b/libbb/wfopen.c
index 76dc8b82a..20fe18b23 100644
--- a/libbb/wfopen.c
+++ b/libbb/wfopen.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12FILE* FAST_FUNC fopen_or_warn(const char *path, const char *mode) 11FILE* FAST_FUNC fopen_or_warn(const char *path, const char *mode)
diff --git a/libbb/wfopen_input.c b/libbb/wfopen_input.c
index d8b1c4a36..872464248 100644
--- a/libbb/wfopen_input.c
+++ b/libbb/wfopen_input.c
@@ -6,14 +6,13 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* A number of applets need to open a file for reading, where the filename 11/* A number of applets need to open a file for reading, where the filename
11 * is a command line arg. Since often that arg is '-' (meaning stdin), 12 * is a command line arg. Since often that arg is '-' (meaning stdin),
12 * we avoid testing everywhere by consolidating things in this routine. 13 * we avoid testing everywhere by consolidating things in this routine.
13 */ 14 */
14 15
15#include "libbb.h"
16
17FILE* FAST_FUNC fopen_or_warn_stdin(const char *filename) 16FILE* FAST_FUNC fopen_or_warn_stdin(const char *filename)
18{ 17{
19 FILE *fp = stdin; 18 FILE *fp = stdin;
diff --git a/libbb/write.c b/libbb/write.c
index 2d67a7281..dd64b0032 100644
--- a/libbb/write.c
+++ b/libbb/write.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Open file and write string str to it, close file. 11/* Open file and write string str to it, close file.
diff --git a/libbb/xatonum.c b/libbb/xatonum.c
index b63b7f54d..7639a62aa 100644
--- a/libbb/xatonum.c
+++ b/libbb/xatonum.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12#define type long long 11#define type long long
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index 523bb62b1..a6127508b 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include <sys/types.h> 9#include <sys/types.h>
11#include <sys/socket.h> /* netinet/in.h needs it */ 10#include <sys/socket.h> /* netinet/in.h needs it */
12#include <netinet/in.h> 11#include <netinet/in.h>
diff --git a/libbb/xfunc_die.c b/libbb/xfunc_die.c
index 73f7998e5..25b99066d 100644
--- a/libbb/xfunc_die.c
+++ b/libbb/xfunc_die.c
@@ -6,12 +6,11 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h"
9 10
10/* Keeping it separate allows to NOT pull in stdio for VERY small applets. 11/* Keeping it separate allows to NOT pull in stdio for VERY small applets.
11 * Try building busybox with only "true" enabled... */ 12 * Try building busybox with only "true" enabled... */
12 13
13#include "libbb.h"
14
15void (*die_func)(void); 14void (*die_func)(void);
16 15
17void FAST_FUNC xfunc_die(void) 16void FAST_FUNC xfunc_die(void)
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 0dfb3e2d9..43ae98065 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11
12/* We need to have separate xfuncs.c and xfuncs_printf.c because 11/* We need to have separate xfuncs.c and xfuncs_printf.c because
13 * with current linkers, even with section garbage collection, 12 * with current linkers, even with section garbage collection,
14 * if *.o module references any of XXXprintf functions, you pull in 13 * if *.o module references any of XXXprintf functions, you pull in
@@ -21,7 +20,6 @@
21 * 20 *
22 * TODO: move xmalloc() and xatonum() here. 21 * TODO: move xmalloc() and xatonum() here.
23 */ 22 */
24
25#include "libbb.h" 23#include "libbb.h"
26 24
27/* Turn on nonblocking I/O on a fd */ 25/* Turn on nonblocking I/O on a fd */
@@ -357,6 +355,15 @@ int FAST_FUNC get_termios_and_make_raw(int fd, struct termios *newterm, struct t
357 */ 355 */
358 } 356 }
359 if (flags & TERMIOS_RAW_INPUT) { 357 if (flags & TERMIOS_RAW_INPUT) {
358#ifndef IMAXBEL
359# define IMAXBEL 0
360#endif
361#ifndef IUCLC
362# define IUCLC 0
363#endif
364#ifndef IXANY
365# define IXANY 0
366#endif
360 /* IXOFF=0: disable sending XON/XOFF if input buf is full */ 367 /* IXOFF=0: disable sending XON/XOFF if input buf is full */
361 /* IXON=0: input XON/XOFF chars are not special */ 368 /* IXON=0: input XON/XOFF chars are not special */
362 /* dont convert anything on input */ 369 /* dont convert anything on input */
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index b6ccd82b2..7032e5f8f 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11
12/* We need to have separate xfuncs.c and xfuncs_printf.c because 11/* We need to have separate xfuncs.c and xfuncs_printf.c because
13 * with current linkers, even with section garbage collection, 12 * with current linkers, even with section garbage collection,
14 * if *.o module references any of XXXprintf functions, you pull in 13 * if *.o module references any of XXXprintf functions, you pull in
@@ -19,7 +18,6 @@
19 * which do not pull in printf, directly or indirectly. 18 * which do not pull in printf, directly or indirectly.
20 * xfunc_printf.c contains those which do. 19 * xfunc_printf.c contains those which do.
21 */ 20 */
22
23#include "libbb.h" 21#include "libbb.h"
24 22
25 23
diff --git a/libbb/xgetcwd.c b/libbb/xgetcwd.c
index 71720d323..7f9088bda 100644
--- a/libbb/xgetcwd.c
+++ b/libbb/xgetcwd.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11
12#include "libbb.h" 11#include "libbb.h"
13 12
14/* Return the current directory, newly allocated, arbitrarily long. 13/* Return the current directory, newly allocated, arbitrarily long.
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index 2c5a9ef39..b3118b433 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -5,7 +5,6 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8
9#include "libbb.h" 8#include "libbb.h"
10 9
11/* Some systems (eg Hurd) do not have MAXSYMLINKS definition, 10/* Some systems (eg Hurd) do not have MAXSYMLINKS definition,
diff --git a/libbb/xrealloc_vector.c b/libbb/xrealloc_vector.c
index e8d31b7e4..dda5f3f7d 100644
--- a/libbb/xrealloc_vector.c
+++ b/libbb/xrealloc_vector.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11 10
12/* Resize (grow) malloced vector. 11/* Resize (grow) malloced vector.
diff --git a/libbb/xregcomp.c b/libbb/xregcomp.c
index 344028f44..5870012d0 100644
--- a/libbb/xregcomp.c
+++ b/libbb/xregcomp.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11#include "libbb.h" 10#include "libbb.h"
12#include "xregex.h" 11#include "xregex.h"
13 12