From ebe6d9d8758d36e03cf39b6587597c67ab778436 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 5 Oct 2017 14:40:24 +0200 Subject: whitespace and comment format fixes, no code changes Signed-off-by: Denys Vlasenko --- libbb/ask_confirmation.c | 3 +-- libbb/bb_askpass.c | 1 - libbb/bb_do_delay.c | 1 - libbb/bb_pwd.c | 1 - libbb/bb_qsort.c | 1 - libbb/bb_strtod.c | 1 - libbb/bb_strtonum.c | 1 - libbb/bbunit.c | 2 +- libbb/change_identity.c | 1 - libbb/chomp.c | 1 - libbb/compare_string_array.c | 1 - libbb/concat_path_file.c | 3 +-- libbb/concat_subpath_file.c | 3 +-- libbb/copyfd.c | 1 - libbb/correct_password.c | 1 - libbb/crc32.c | 1 - libbb/default_error_retval.c | 2 -- libbb/device_open.c | 1 - libbb/die_if_bad_username.c | 1 - libbb/dump.c | 1 - libbb/executable.c | 1 - libbb/fclose_nonstdin.c | 4 +--- libbb/fflush_stdout_and_exit.c | 4 +--- libbb/fgets_str.c | 1 - libbb/find_mount_point.c | 1 - libbb/find_pid_by_name.c | 1 - libbb/find_root_device.c | 1 - libbb/full_write.c | 1 - libbb/get_console.c | 1 - libbb/get_line_from_file.c | 1 - libbb/getpty.c | 1 - libbb/hash_md5_sha.c | 1 - libbb/human_readable.c | 1 - libbb/in_ether.c | 1 - libbb/inet_common.c | 1 - libbb/inode_hash.c | 1 - libbb/isdirectory.c | 1 - libbb/kernel_version.c | 2 -- libbb/last_char_is.c | 1 - libbb/llist.c | 1 - libbb/login.c | 1 - libbb/make_directory.c | 2 -- libbb/match_fstype.c | 1 - libbb/messages.c | 1 - libbb/mode_string.c | 2 -- libbb/mtab.c | 1 - libbb/nuke_str.c | 1 - libbb/parse_mode.c | 3 +-- libbb/percent_decode.c | 1 - libbb/printable.c | 1 - libbb/process_escape_sequence.c | 1 - libbb/procps.c | 1 - libbb/ptr_to_globals.c | 1 - libbb/pw_encrypt.c | 1 - libbb/recursive_action.c | 1 - libbb/remove_file.c | 1 - libbb/replace.c | 1 - libbb/run_shell.c | 1 - libbb/safe_gethostname.c | 2 -- libbb/safe_poll.c | 1 - libbb/safe_strncpy.c | 1 - libbb/safe_write.c | 1 - libbb/setup_environment.c | 1 - libbb/signals.c | 1 - libbb/skip_whitespace.c | 1 - libbb/speed_table.c | 1 - libbb/strrstr.c | 1 - libbb/trim.c | 1 - libbb/uuencode.c | 1 - libbb/wfopen.c | 1 - libbb/wfopen_input.c | 3 +-- libbb/write.c | 1 - libbb/xatonum.c | 1 - libbb/xconnect.c | 1 - libbb/xfunc_die.c | 3 +-- libbb/xfuncs.c | 2 -- libbb/xfuncs_printf.c | 2 -- libbb/xgetcwd.c | 1 - libbb/xreadlink.c | 1 - libbb/xrealloc_vector.c | 1 - libbb/xregcomp.c | 1 - 81 files changed, 9 insertions(+), 98 deletions(-) (limited to 'libbb') 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y', * return 1. Otherwise return 0. */ -#include "libbb.h" - int FAST_FUNC bb_ask_confirmation(void) { 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" void 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" int /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #include /* just for HUGE_VAL */ 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//applet:IF_UNIT_TEST(APPLET(unit, BB_DIR_USR_BIN, BB_SUID_DROP)) //kbuild:lib-$(CONFIG_UNIT_TEST) += bbunit.o -//applet:IF_UNIT_TEST(APPLET(unit, BB_DIR_USR_BIN, BB_SUID_DROP)) //usage:#define unit_trivial_usage //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 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" void 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 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* Concatenate path and filename to new allocated buffer. * Add '/' only as needed (no duplicate // are produced). @@ -14,8 +15,6 @@ * filename should not be NULL. */ -#include "libbb.h" - char* FAST_FUNC concat_path_file(const char *path, const char *filename) { 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* This function make special for recursive actions with usage @@ -13,8 +14,6 @@ and skipping "." and ".." directory entries */ -#include "libbb.h" - char* FAST_FUNC concat_subpath_file(const char *path, const char *f) { 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #if ENABLE_FEATURE_USE_SENDFILE # include 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 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - #include "libbb.h" #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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" uint32_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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* Seems silly to copyright a global variable. ;-) Oh well. * * At least one applet (cmp) returns a value different from the typical @@ -12,7 +11,6 @@ * by the applet. I suppose we could use a wrapper function to set it, but * that too seems silly. */ - #include "libbb.h" uint8_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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Original copyright notice is retained at the end of this file. */ - #include "libbb.h" #include "dump.h" diff --git a/libbb/executable.c b/libbb/executable.c index 3a1d4ff44..325dd0107 100644 --- a/libbb/executable.c +++ b/libbb/executable.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* A number of standard utilities can accept multiple command line args * of '-' for stdin, according to SUSv3. So we encapsulate the check * here to save a little space. */ - -#include "libbb.h" - int FAST_FUNC fclose_if_not_stdin(FILE *f) { /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* Attempt to fflush(stdout), and exit with an error code if stdout is * in an error state. */ - -#include "libbb.h" - void FAST_FUNC fflush_stdout_and_exit(int retval) { 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" static 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 9676b5f52..94bbf1d4a 100644 --- a/libbb/find_mount_point.c +++ b/libbb/find_mount_point.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #include diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c index db823d05b..abbf293e8 100644 --- a/libbb/find_pid_by_name.c +++ b/libbb/find_pid_by_name.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* From */ diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index a98dd35eb..cc61a9265 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c @@ -8,7 +8,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" char* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" const 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 @@ /* * Utility routines. */ - //kbuild:lib-$(CONFIG_ARP) += in_ether.o //kbuild:lib-$(CONFIG_IFCONFIG) += in_ether.o //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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" #include "inet_common.h" diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c index f11c2afb2..4142813e3 100644 --- a/libbb/inode_hash.c +++ b/libbb/inode_hash.c @@ -7,7 +7,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" typedef struct ino_dev_hash_bucket_struct { diff --git a/libbb/isdirectory.c b/libbb/isdirectory.c index ba6c52ce8..462aa0067 100644 --- a/libbb/isdirectory.c +++ b/libbb/isdirectory.c @@ -7,7 +7,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include #include "libbb.h" 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* After libbb.h, since it needs sys/types.h on some systems */ #include /* for uname(2) */ - /* Returns current kernel version encoded as major*65536 + minor*256 + patch, * so, for example, to check if the kernel is greater than 2.2.11: * 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* Find out if the last character of a string matches the one given. 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* After libbb.h, since it needs sys/types.h on some systems */ #include diff --git a/libbb/make_directory.c b/libbb/make_directory.c index a6b7c28df..b9916d165 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* Mar 5, 2003 Manuel Novoa III * * This is the main work function for the 'mkdir' applet. As such, it @@ -21,7 +20,6 @@ * To set specific permissions on 'path', pass the appropriate 'mode' * val. Otherwise, pass -1 to get default permissions. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" int FAST_FUNC fstype_matches(const char *fstype, const char *comma_list) diff --git a/libbb/messages.c b/libbb/messages.c index 27fd14ecc..0a6cf3bf8 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -4,7 +4,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* allow default system PATH to be extended via CFLAGS */ diff --git a/libbb/mode_string.c b/libbb/mode_string.c index 934eb6dc7..280e6d291 100644 --- a/libbb/mode_string.c +++ b/libbb/mode_string.c @@ -10,8 +10,6 @@ /* Aug 13, 2003 * Fix a bug reported by junkio@cox.net involving the mode_chars index. */ - - #include #include 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include #include "libbb.h" 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - //kbuild:lib-y += nuke_str.o #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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */ -#include "libbb.h" - /* This function is used from NOFORK applets. It must not allocate anything */ #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 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - //kbuild:lib-y += percent_decode.o #include "libbb.h" 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" void 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #define WANT_HEX_ESCAPES 1 diff --git a/libbb/procps.c b/libbb/procps.c index b52c0f51b..9d8a921df 100644 --- a/libbb/procps.c +++ b/libbb/procps.c @@ -8,7 +8,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include struct 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - //kbuild:lib-y += replace.o #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 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - #include "libbb.h" #if ENABLE_SELINUX #include /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* * SUSv2 guarantees that "Host names are limited to 255 bytes" * POSIX.1-2001 guarantees that "Host names (not including the terminating @@ -23,7 +22,6 @@ * Host software MUST handle host names of up to 63 characters and * SHOULD handle host names of up to 255 characters. */ - #include "libbb.h" #include 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" ssize_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 91b6d94db..f8de44967 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c @@ -27,7 +27,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - #include "libbb.h" void FAST_FUNC setup_environment(const char *shell, int flags, const struct passwd *pw) 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" char* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" struct 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" char* FAST_FUNC trim(char *s) 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" FILE* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +#include "libbb.h" /* A number of applets need to open a file for reading, where the filename * is a command line arg. Since often that arg is '-' (meaning stdin), * we avoid testing everywhere by consolidating things in this routine. */ -#include "libbb.h" - FILE* FAST_FUNC fopen_or_warn_stdin(const char *filename) { 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" #define type long long diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 3a0dc2653..39e56b223 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include #include /* netinet/in.h needs it */ #include 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +#include "libbb.h" /* Keeping it separate allows to NOT pull in stdio for VERY small applets. * Try building busybox with only "true" enabled... */ -#include "libbb.h" - void (*die_func)(void); void FAST_FUNC xfunc_die(void) diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 0dfb3e2d9..9cbfb2836 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -8,7 +8,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - /* We need to have separate xfuncs.c and xfuncs_printf.c because * with current linkers, even with section garbage collection, * if *.o module references any of XXXprintf functions, you pull in @@ -21,7 +20,6 @@ * * TODO: move xmalloc() and xatonum() here. */ - #include "libbb.h" /* Turn on nonblocking I/O on a fd */ diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index f569b0263..2bc01ad10 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c @@ -8,7 +8,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - /* We need to have separate xfuncs.c and xfuncs_printf.c because * with current linkers, even with section garbage collection, * if *.o module references any of XXXprintf functions, you pull in @@ -19,7 +18,6 @@ * which do not pull in printf, directly or indirectly. * xfunc_printf.c contains those which do. */ - #include "libbb.h" 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" /* Return the current directory, newly allocated, arbitrarily long. diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 7d4cb60a5..9b62bcc43 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c @@ -5,7 +5,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - #include "libbb.h" /* 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 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #include "libbb.h" #include "xregex.h" -- cgit v1.2.3-55-g6feb From 416899fca6c8b7a09ec301e1a961459bb3b6c139 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 5 Oct 2017 14:41:36 +0200 Subject: do not include just before "libbb.h", it's there already Signed-off-by: Denys Vlasenko --- libbb/isdirectory.c | 1 - libbb/mode_string.c | 6 ------ 2 files changed, 7 deletions(-) (limited to 'libbb') diff --git a/libbb/isdirectory.c b/libbb/isdirectory.c index 462aa0067..6225a34b2 100644 --- a/libbb/isdirectory.c +++ b/libbb/isdirectory.c @@ -7,7 +7,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ -#include #include "libbb.h" /* diff --git a/libbb/mode_string.c b/libbb/mode_string.c index 280e6d291..5ffd5683e 100644 --- a/libbb/mode_string.c +++ b/libbb/mode_string.c @@ -6,13 +6,7 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - -/* Aug 13, 2003 - * Fix a bug reported by junkio@cox.net involving the mode_chars index. - */ #include -#include - #include "libbb.h" #if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \ -- cgit v1.2.3-55-g6feb From a02a4e98306194dc12bca46d099647bcce602bb9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 5 Oct 2017 15:19:25 +0200 Subject: whitespace and comment format fixes, no code changes Signed-off-by: Denys Vlasenko --- coreutils/basename.c | 1 - coreutils/fold.c | 3 ++- coreutils/libcoreutils/coreutils.h | 1 - coreutils/libcoreutils/cp_mv_stat.c | 2 -- coreutils/libcoreutils/getopt_mk_fifo_nod.c | 2 -- coreutils/mktemp.c | 2 -- coreutils/nohup.c | 3 ++- coreutils/printf.c | 3 ++- coreutils/realpath.c | 3 ++- coreutils/stty.c | 3 ++- coreutils/tr.c | 2 +- coreutils/uname.c | 3 ++- coreutils/unlink.c | 3 ++- coreutils/who.c | 4 +--- libbb/appletlib.c | 1 - networking/ifconfig.c | 5 ++--- networking/libiproute/ip_parse_common_args.c | 1 - networking/libiproute/ipaddress.c | 1 - networking/libiproute/iproute.c | 1 - networking/libiproute/iprule.c | 1 - networking/libiproute/iptunnel.c | 1 - networking/libiproute/ll_addr.c | 2 -- networking/libiproute/rtm_map.c | 2 -- networking/libiproute/utils.c | 1 - networking/nc.c | 3 ++- networking/route.c | 4 ++-- networking/telnet.c | 1 - networking/zcip.c | 1 - 28 files changed, 22 insertions(+), 38 deletions(-) (limited to 'libbb') diff --git a/coreutils/basename.c b/coreutils/basename.c index 566aeebda..812a5e63e 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) * * Changes: diff --git a/coreutils/fold.c b/coreutils/fold.c index 578e5a4b6..1e26dde0c 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* fold -- wrap each input line to fit in specified width. +/* + * fold -- wrap each input line to fit in specified width. * * Written by David MacKenzie, djm@gnu.ai.mit.edu. * Copyright (C) 91, 1995-2002 Free Software Foundation, Inc. diff --git a/coreutils/libcoreutils/coreutils.h b/coreutils/libcoreutils/coreutils.h index 307d0330a..ad102e423 100644 --- a/coreutils/libcoreutils/coreutils.h +++ b/coreutils/libcoreutils/coreutils.h @@ -2,7 +2,6 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - #ifndef COREUTILS_H #define COREUTILS_H 1 diff --git a/coreutils/libcoreutils/cp_mv_stat.c b/coreutils/libcoreutils/cp_mv_stat.c index 5ba07ecc3..26c0e1645 100644 --- a/coreutils/libcoreutils/cp_mv_stat.c +++ b/coreutils/libcoreutils/cp_mv_stat.c @@ -17,9 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ - #include "libbb.h" #include "coreutils.h" diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c index 47375ff91..dafe70edf 100644 --- a/coreutils/libcoreutils/getopt_mk_fifo_nod.c +++ b/coreutils/libcoreutils/getopt_mk_fifo_nod.c @@ -17,9 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ - #include "libbb.h" #include "coreutils.h" diff --git a/coreutils/mktemp.c b/coreutils/mktemp.c index d4ff883fa..c041fedf7 100644 --- a/coreutils/mktemp.c +++ b/coreutils/mktemp.c @@ -2,13 +2,11 @@ /* * Mini mktemp implementation for busybox * - * * Copyright (C) 2000 by Daniel Jacobowitz * Written by Daniel Jacobowitz * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* Coreutils 6.12 man page says: * mktemp [OPTION]... [TEMPLATE] * Create a temporary file or directory, safely, and print its name. If diff --git a/coreutils/nohup.c b/coreutils/nohup.c index 8a70ec4df..ae136e085 100644 --- a/coreutils/nohup.c +++ b/coreutils/nohup.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* nohup - invoke a utility immune to hangups. +/* + * nohup - invoke a utility immune to hangups. * * Busybox version based on nohup specification at * http://www.opengroup.org/onlinepubs/007904975/utilities/nohup.html diff --git a/coreutils/printf.c b/coreutils/printf.c index 413273b26..a666ff7ac 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* printf - format and print data +/* + * printf - format and print data * * Copyright 1999 Dave Cinege * Portions copyright (C) 1990-1996 Free Software Foundation, Inc. diff --git a/coreutils/realpath.c b/coreutils/realpath.c index f9c630135..aa878fcd2 100644 --- a/coreutils/realpath.c +++ b/coreutils/realpath.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) +/* + * Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) * * Now does proper error checking on output and returns a failure exit code * if one or more paths cannot be resolved. diff --git a/coreutils/stty.c b/coreutils/stty.c index df23f4cae..424d909cf 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* stty -- change and print terminal line settings +/* + * stty -- change and print terminal line settings * Copyright (C) 1990-1999 Free Software Foundation, Inc. * * Licensed under GPLv2 or later, see file LICENSE in this source tree. diff --git a/coreutils/tr.c b/coreutils/tr.c index c5872434a..10284e1c9 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -2,7 +2,7 @@ /* * Mini tr implementation for busybox * - ** Copyright (c) 1987,1997, Prentice Hall All rights reserved. + * Copyright (c) 1987,1997, Prentice Hall All rights reserved. * * The name of Prentice Hall may not be used to endorse or promote * products derived from this software without specific prior diff --git a/coreutils/uname.c b/coreutils/uname.c index bb2d1fe8d..57039b1bf 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* uname -- print system information +/* + * uname -- print system information * Copyright (C) 1989-1999 Free Software Foundation, Inc. * * Licensed under GPLv2 or later, see file LICENSE in this source tree. diff --git a/coreutils/unlink.c b/coreutils/unlink.c index 56309b1c7..61b108a84 100644 --- a/coreutils/unlink.c +++ b/coreutils/unlink.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* unlink for busybox +/* + * unlink for busybox * * Copyright (C) 2014 Isaac Dunham * diff --git a/coreutils/who.c b/coreutils/who.c index cfe0c921e..80226c3d6 100644 --- a/coreutils/who.c +++ b/coreutils/who.c @@ -1,5 +1,5 @@ /* vi: set sw=4 ts=4: */ -/*---------------------------------------------------------------------- +/* * Mini who is used to display user name, login time, * idle time and host name. * @@ -13,8 +13,6 @@ * Copyright (c) 2002 AYR Networks, Inc. * * Licensed under GPLv2 or later, see file LICENSE in this source tree. - * - *---------------------------------------------------------------------- */ //config:config WHO //config: bool "who (3.7 kb)" diff --git a/libbb/appletlib.c b/libbb/appletlib.c index cbca7ef17..022455da4 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -11,7 +11,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* We are trying to not use printf, this benefits the case when selected * applets are really simple. Example: * diff --git a/networking/ifconfig.c b/networking/ifconfig.c index d1e9c58dc..61d91788a 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -1,18 +1,17 @@ /* vi: set sw=4 ts=4: */ -/* ifconfig +/* + * ifconfig * * Similar to the standard Unix ifconfig, but with only the necessary * parts for AF_INET, and without any printing of if info (for now). * * Bjorn Wesen, Axis Communications AB * - * * Authors of the original ifconfig was: * Fred N. van Kempen, * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* * Heavily modified by Manuel Novoa III Mar 6, 2001 * diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c index 1a298f738..d693c54fa 100644 --- a/networking/libiproute/ip_parse_common_args.c +++ b/networking/libiproute/ip_parse_common_args.c @@ -11,7 +11,6 @@ * * Rani Assaf 980929: resolve addresses */ - #include "ip_common.h" /* #include "libbb.h" is inside */ #include "utils.h" diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 36d6b65c6..921ecf0d9 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -7,7 +7,6 @@ * Changes: * Laszlo Valko 990223: address label must be zero terminated */ - #include #include #include diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 6a41b8331..e8b26cb2f 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c @@ -9,7 +9,6 @@ * Rani Assaf 980929: resolve addresses * Kunihiro Ishiguro 001102: rtnh_ifindex was not initialized */ - #include "ip_common.h" /* #include "libbb.h" is inside */ #include "common_bufsiz.h" #include "rt_names.h" diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index 1bb5e759e..9938b4793 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c @@ -12,7 +12,6 @@ * Rani Assaf 980929: resolve addresses * initially integrated into busybox by Bernhard Reutner-Fischer */ - #include #include #include diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index eb136e435..4002feb78 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c @@ -10,7 +10,6 @@ * Rani Assaf 980930: do not allow key for ipip/sit * Phil Karn 990408: "pmtudisc" flag */ - #include #include #include diff --git a/networking/libiproute/ll_addr.c b/networking/libiproute/ll_addr.c index 33a54ea6c..afdd81ffb 100644 --- a/networking/libiproute/ll_addr.c +++ b/networking/libiproute/ll_addr.c @@ -7,14 +7,12 @@ * * Authors: Alexey Kuznetsov, */ - #include #include "libbb.h" #include "rt_names.h" #include "utils.h" - const char* FAST_FUNC ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen) { int i; diff --git a/networking/libiproute/rtm_map.c b/networking/libiproute/rtm_map.c index c763da049..e94c99ab6 100644 --- a/networking/libiproute/rtm_map.c +++ b/networking/libiproute/rtm_map.c @@ -7,7 +7,6 @@ * * Authors: Alexey Kuznetsov, */ - #include "libbb.h" #include "rt_names.h" #include "utils.h" @@ -44,7 +43,6 @@ const char* FAST_FUNC rtnl_rtntype_n2a(int id) } } - int FAST_FUNC rtnl_rtntype_a2n(int *id, char *arg) { static const char keywords[] ALIGN1 = diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index fca167ac6..bf053a54b 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c @@ -8,7 +8,6 @@ * * Rani Assaf 980929: resolve addresses */ - #include "libbb.h" #include "utils.h" #include "inet_common.h" diff --git a/networking/nc.c b/networking/nc.c index f7fc9741f..b208f46c6 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* nc: mini-netcat - built from the ground up for LRP +/* + * nc: mini-netcat - built from the ground up for LRP * * Copyright (C) 1998, 1999 Charles P. Wright * Copyright (C) 1998 Dave Cinege diff --git a/networking/route.c b/networking/route.c index 32789eecc..6edc0f6d7 100644 --- a/networking/route.c +++ b/networking/route.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* route +/* + * route * * Similar to the standard Unix route, but with only the necessary * parts for AF_INET and AF_INET6 @@ -18,7 +19,6 @@ * * IPV6 support added by Bart Visscher */ - /* 2004/03/09 Manuel Novoa III * * Rewritten to fix several bugs, add additional error checking, and diff --git a/networking/telnet.c b/networking/telnet.c index 1f8a44466..8b0df7f5c 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -18,7 +18,6 @@ * * Modified 2004/02/11 to add ability to pass the USER variable to remote host * by Fernando Silveira - * */ //config:config TELNET //config: bool "telnet (8.7 kb)" diff --git a/networking/zcip.c b/networking/zcip.c index 55440285f..94e49adcb 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -8,7 +8,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - /* * ZCIP just manages the 169.254.*.* addresses. That network is not * routed at the IP level, though various proxies or bridges can -- cgit v1.2.3-55-g6feb From 2ab9403119399ffda26f6ff83ec60ac257c29898 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 5 Oct 2017 15:33:28 +0200 Subject: whitespace and comment format fixes, no code changes Signed-off-by: Denys Vlasenko --- archival/libarchive/decompress_bunzip2.c | 3 ++- archival/libarchive/decompress_uncompress.c | 6 ++---- archival/libarchive/get_header_ar.c | 3 ++- archival/libarchive/get_header_cpio.c | 3 ++- archival/libarchive/get_header_tar.c | 3 ++- libbb/print_flags.c | 3 ++- libpwdgrp/pwd_grp.c | 3 ++- miscutils/bbconfig.c | 3 ++- miscutils/flash_eraseall.c | 3 ++- miscutils/flash_lock_unlock.c | 3 ++- miscutils/ubi_tools.c | 3 ++- util-linux/fdformat.c | 3 ++- util-linux/fdisk.c | 3 ++- util-linux/mkswap.c | 3 ++- util-linux/switch_root.c | 3 ++- 15 files changed, 30 insertions(+), 18 deletions(-) (limited to 'libbb') diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c index af879648d..7cd18f5ed 100644 --- a/archival/libarchive/decompress_bunzip2.c +++ b/archival/libarchive/decompress_bunzip2.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net). +/* + * Small bzip2 deflate implementation, by Rob Landley (rob@landley.net). * * Based on bzip2 decompression code by Julian R Seward (jseward@acm.org), * which also acknowledges contributions by Mike Burrows, David Wheeler, diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c index 034ed502d..1517559c6 100644 --- a/archival/libarchive/decompress_uncompress.c +++ b/archival/libarchive/decompress_uncompress.c @@ -1,10 +1,10 @@ /* vi: set sw=4 ts=4: */ -/* uncompress for busybox -- (c) 2002 Robert Griebl +/* + * uncompress for busybox -- (c) 2002 Robert Griebl * * based on the original compress42.c source * (see disclaimer below) */ - /* (N)compress42.c - File compression ala IEEE Computer, Mar 1992. * * Authors: @@ -21,9 +21,7 @@ * marc@suse.de : a small security fix for a buffer overflow * * [... History snipped ...] - * */ - #include "libbb.h" #include "bb_archive.h" diff --git a/archival/libarchive/get_header_ar.c b/archival/libarchive/get_header_ar.c index 79725e535..1809ec396 100644 --- a/archival/libarchive/get_header_ar.c +++ b/archival/libarchive/get_header_ar.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Copyright 2001 Glenn McGrath. +/* + * Copyright 2001 Glenn McGrath. * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ diff --git a/archival/libarchive/get_header_cpio.c b/archival/libarchive/get_header_cpio.c index ba07622fd..75fc6a406 100644 --- a/archival/libarchive/get_header_cpio.c +++ b/archival/libarchive/get_header_cpio.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Copyright 2002 Laurence Anderson +/* + * Copyright 2002 Laurence Anderson * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index 443a478a1..aeb54190f 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Licensed under GPLv2 or later, see file LICENSE in this source tree. +/* + * Licensed under GPLv2 or later, see file LICENSE in this source tree. * * FIXME: * In privileged mode if uname and gname map to a uid and gid then use the 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 @@ /* vi: set sw=4 ts=4: */ -/* Print string that matches bit masked flags +/* + * Print string that matches bit masked flags * * Copyright (C) 2008 Natanael Copa * diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index 7e3568f80..b44ada432 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Copyright (C) 2014 Tito Ragusa +/* + * Copyright (C) 2014 Tito Ragusa * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c index 045aca211..9ab57876e 100644 --- a/miscutils/bbconfig.c +++ b/miscutils/bbconfig.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* This file was released into the public domain by Paul Fox. +/* + * This file was released into the public domain by Paul Fox. */ //config:config BBCONFIG //config: bool "bbconfig (9.7 kb)" diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index a6ce41f27..fab21291c 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* eraseall.c -- erase the whole of a MTD device +/* + * eraseall.c -- erase the whole of a MTD device * * Ported to busybox from mtd-utils. * diff --git a/miscutils/flash_lock_unlock.c b/miscutils/flash_lock_unlock.c index 6f2c049f4..12f72efaf 100644 --- a/miscutils/flash_lock_unlock.c +++ b/miscutils/flash_lock_unlock.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Ported to busybox from mtd-utils. +/* + * Ported to busybox from mtd-utils. * * Licensed under GPLv2, see file LICENSE in this source tree. */ diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index 1ef8fd90e..a947abab5 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c @@ -1,4 +1,5 @@ -/* Ported to busybox from mtd-utils. +/* + * Ported to busybox from mtd-utils. * * Licensed under GPLv2, see file LICENSE in this source tree. */ diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 855269c30..c72da8b89 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger +/* + * fdformat.c - Low-level formats a floppy disk - Werner Almesberger * 5 July 2003 -- modified for Busybox by Erik Andersen * * Licensed under GPLv2, see file LICENSE in this source tree. diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index c4318b6c4..7275535e6 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* fdisk.c -- Partition table manipulator for Linux. +/* + * fdisk.c -- Partition table manipulator for Linux. * * Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk) * Copyright (C) 2001,2002 Vladimir Oleynik (initial bb port) diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 71449882d..2eb16bd84 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* mkswap.c - format swap device (Linux v1 only) +/* + * mkswap.c - format swap device (Linux v1 only) * * Copyright 2006 Rob Landley * diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 080b05e45..2d1802b79 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -1,5 +1,6 @@ /* vi: set sw=4 ts=4: */ -/* Copyright 2005 Rob Landley +/* + * Copyright 2005 Rob Landley * * Switch from rootfs to another filesystem as the root of the mount tree. * -- cgit v1.2.3-55-g6feb From 0fd5dbba8f34e006aa0e999002d31e79daf2fdf3 Mon Sep 17 00:00:00 2001 From: Avi Halachmi Date: Thu, 12 Oct 2017 16:38:35 +0200 Subject: lineedit: improve multiline PS1 - redraw using last PS1 line. Closes 10381 This patch only affects prompts with newlines. We redraw the prompt [+ input] occasionally, e.g. during tab completion, history browsing or search, etc, and we expect it to align with prior redraws, such that the visible effect is that only the input changes. With multi-line PS1, redraw always printed the prompt some lines below the old one, which resulted in terminal scroll during every redraw. Now we only redraw the last PS1 line, so vertical alignment is easier to manage (we already calculated it using only the last line, but re-drew all lines - that was the culprit), which fixes those extra scrolls. Notes: - We now use the full prompt for the initial draw, after clear-screen (^L), and after tab-completion choices are displayed. Everything else now redraws using the last/sole prompt line. - During terminal resize we now only redraw the last[/sole] prompt line, which is arguably better because it's hard to do right (and we never did). - Good side effect for reverse-i-search: its prompt now replaces only the last line of the original prompt - like other shells do. function old new delta put_prompt_custom - 66 +66 draw_custom - 66 +66 parse_and_put_prompt 766 806 +40 read_line_input 3867 3884 +17 input_tab 1069 1076 +7 cmdedit_setwidth 61 63 +2 redraw 59 47 -12 put_prompt 46 - -46 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 4/1 up/down: 198/-58) Total: 140 bytes Signed-off-by: Avi Halachmi Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 88 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 24 deletions(-) (limited to 'libbb') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 3a092ffe2..c0e35bb21 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -37,11 +37,6 @@ * * Unicode in PS1 is not fully supported: prompt length calulation is wrong, * resulting in line wrap problems with long (multi-line) input. - * - * Multi-line PS1 (e.g. PS1="\n[\w]\n$ ") has problems with history - * browsing: up/down arrows result in scrolling. - * It stems from simplistic "cmdedit_y = cmdedit_prmt_len / cmdedit_termw" - * calculation of how many lines the prompt takes. */ #include "busybox.h" #include "NUM_APPLETS.h" @@ -133,7 +128,7 @@ struct lineedit_statics { unsigned cmdedit_x; /* real x (col) terminal position */ unsigned cmdedit_y; /* pseudoreal y (row) terminal position */ - unsigned cmdedit_prmt_len; /* length of prompt (without colors etc) */ + unsigned cmdedit_prmt_len; /* on-screen length of last/sole prompt line */ unsigned cursor; int command_len; /* must be signed */ @@ -143,6 +138,7 @@ struct lineedit_statics { CHAR_T *command_ps; const char *cmdedit_prompt; + const char *prompt_last_line; /* last/sole prompt line */ #if ENABLE_USERNAME_OR_HOMEDIR char *user_buf; @@ -185,6 +181,7 @@ extern struct lineedit_statics *const lineedit_ptr_to_statics; #define command_len (S.command_len ) #define command_ps (S.command_ps ) #define cmdedit_prompt (S.cmdedit_prompt ) +#define prompt_last_line (S.prompt_last_line) #define user_buf (S.user_buf ) #define home_pwd_buf (S.home_pwd_buf ) #define matches (S.matches ) @@ -437,14 +434,20 @@ static void beep(void) bb_putchar('\007'); } -static void put_prompt(void) +/* Full or last/sole prompt line, reset edit cursor, calculate terminal cursor. + * cmdedit_y is always calculated for the last/sole prompt line. + */ +static void put_prompt_custom(bool is_full) { - fputs(cmdedit_prompt, stdout); + fputs((is_full ? cmdedit_prompt : prompt_last_line), stdout); cursor = 0; cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */ cmdedit_x = cmdedit_prmt_len % cmdedit_termw; } +#define put_prompt_last_line() put_prompt_custom(0) +#define put_prompt() put_prompt_custom(1) + /* Move back one character */ /* (optimized for slow terminals) */ static void input_backward(unsigned num) @@ -509,7 +512,7 @@ static void input_backward(unsigned num) printf("\r" ESC"[%uA", cmdedit_y); cmdedit_y = 0; sv_cursor = cursor; - put_prompt(); /* sets cursor to 0 */ + put_prompt_last_line(); /* sets cursor to 0 */ while (cursor < sv_cursor) put_cur_glyph_and_inc_cursor(); } else { @@ -530,18 +533,27 @@ static void input_backward(unsigned num) } } -/* draw prompt, editor line, and clear tail */ -static void redraw(int y, int back_cursor) +/* See redraw and draw_full below */ +static void draw_custom(int y, int back_cursor, bool is_full) { if (y > 0) /* up y lines */ printf(ESC"[%uA", y); bb_putchar('\r'); - put_prompt(); + put_prompt_custom(is_full); put_till_end_and_adv_cursor(); printf(SEQ_CLEAR_TILL_END_OF_SCREEN); input_backward(back_cursor); } +/* Move y lines up, draw last/sole prompt line, editor line[s], and clear tail. + * goal: redraw the prompt+input+cursor in-place, overwriting the previous */ +#define redraw(y, back_cursor) draw_custom((y), (back_cursor), 0) + +/* Like above, but without moving up, and while using all the prompt lines. + * goal: draw a full prompt+input+cursor unrelated to a previous position. + * note: cmdedit_y always ends up relating to the last/sole prompt line */ +#define draw_full(back_cursor) draw_custom(0, (back_cursor), 1) + /* Delete the char in front of the cursor, optionally saving it * for later putback */ #if !ENABLE_FEATURE_EDITING_VI @@ -1106,7 +1118,7 @@ static NOINLINE void input_tab(smallint *lastWasTab) int sav_cursor = cursor; goto_new_line(); showfiles(); - redraw(0, command_len - sav_cursor); + draw_full(command_len - sav_cursor); } return; } @@ -1782,14 +1794,37 @@ static void ask_terminal(void) #define ask_terminal() ((void)0) #endif +/* Note about multi-line PS1 (e.g. "\n\w \u@\h\n> ") and prompt redrawing: + * + * If the prompt has any newlines, after we print it once we use only its last + * line to redraw in-place, which makes it simpler to calculate how many lines + * we should move the cursor up to align the redraw (cmdedit_y). The earlier + * prompt lines just stay on screen and we redraw below them. + * + * Use cases for all prompt lines beyond the initial draw: + * - After clear-screen (^L) or after displaying tab-completion choices, we + * print the full prompt, as it isn't redrawn in-place. + * - During terminal resize we could try to redraw all lines, but we don't, + * because it requires delicate alignment, it's good enough with only the + * last line, and doing it wrong is arguably worse than not doing it at all. + * + * Terminology wise, if it doesn't mention "full", then it means the last/sole + * prompt line. We use the prompt (last/sole line) while redrawing in-place, + * and the full where we need a fresh one unrelated to an earlier position. + * + * If PS1 is not multiline, the last/sole line and the full are the same string. + */ + /* Called just once at read_line_input() init time */ #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT static void parse_and_put_prompt(const char *prmt_ptr) { const char *p; - cmdedit_prompt = prmt_ptr; + cmdedit_prompt = prompt_last_line = prmt_ptr; p = strrchr(prmt_ptr, '\n'); - cmdedit_prmt_len = unicode_strwidth(p ? p+1 : prmt_ptr); + if (p) + prompt_last_line = p + 1; + cmdedit_prmt_len = unicode_strwidth(prompt_last_line); put_prompt(); } #else @@ -1973,7 +2008,11 @@ static void parse_and_put_prompt(const char *prmt_ptr) if (cwd_buf != (char *)bb_msg_unknown) free(cwd_buf); # endif - cmdedit_prompt = prmt_mem_ptr; + /* see comment (above this function) about multiline prompt redrawing */ + cmdedit_prompt = prompt_last_line = prmt_mem_ptr; + prmt_ptr = strrchr(cmdedit_prompt, '\n'); + if (prmt_ptr) + prompt_last_line = prmt_ptr + 1; put_prompt(); } #endif @@ -2145,7 +2184,7 @@ static int32_t reverse_i_search(int timeout) match_buf[0] = '\0'; /* Save and replace the prompt */ - saved_prompt = cmdedit_prompt; + saved_prompt = prompt_last_line; saved_prmt_len = cmdedit_prmt_len; goto set_prompt; @@ -2218,10 +2257,10 @@ static int32_t reverse_i_search(int timeout) cursor = match - matched_history_line; //FIXME: cursor position for Unicode case - free((char*)cmdedit_prompt); + free((char*)prompt_last_line); set_prompt: - cmdedit_prompt = xasprintf("(reverse-i-search)'%s': ", match_buf); - cmdedit_prmt_len = unicode_strwidth(cmdedit_prompt); + prompt_last_line = xasprintf("(reverse-i-search)'%s': ", match_buf); + cmdedit_prmt_len = unicode_strwidth(prompt_last_line); goto do_redraw; } } @@ -2241,8 +2280,8 @@ static int32_t reverse_i_search(int timeout) if (matched_history_line) command_len = load_string(matched_history_line); - free((char*)cmdedit_prompt); - cmdedit_prompt = saved_prompt; + free((char*)prompt_last_line); + prompt_last_line = saved_prompt; cmdedit_prmt_len = saved_prmt_len; redraw(cmdedit_y, command_len - cursor); @@ -2451,8 +2490,9 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman case CTRL('L'): vi_case(CTRL('L')|VI_CMDMODE_BIT:) /* Control-l -- clear screen */ - printf(ESC"[H"); /* cursor to top,left */ - redraw(0, command_len - cursor); + /* cursor to top,left; clear to the end of screen */ + printf(ESC"[H" ESC"[J"); + draw_full(command_len - cursor); break; #if MAX_HISTORY > 0 case CTRL('N'): -- cgit v1.2.3-55-g6feb From 24e17b43858e165ba8384e2aa7403cecd899ad2d Mon Sep 17 00:00:00 2001 From: James Clarke Date: Mon, 30 Oct 2017 15:18:32 +0100 Subject: xfuncs: Handle missing non-POSIX termios constants Signed-off-by: James Clarke Signed-off-by: Denys Vlasenko --- libbb/xfuncs.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libbb') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 9cbfb2836..43ae98065 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -355,6 +355,15 @@ int FAST_FUNC get_termios_and_make_raw(int fd, struct termios *newterm, struct t */ } if (flags & TERMIOS_RAW_INPUT) { +#ifndef IMAXBEL +# define IMAXBEL 0 +#endif +#ifndef IUCLC +# define IUCLC 0 +#endif +#ifndef IXANY +# define IXANY 0 +#endif /* IXOFF=0: disable sending XON/XOFF if input buf is full */ /* IXON=0: input XON/XOFF chars are not special */ /* dont convert anything on input */ -- cgit v1.2.3-55-g6feb From 518fb3ba193cddc1369090bfdf827618b42791db Mon Sep 17 00:00:00 2001 From: James Clarke Date: Sat, 7 Oct 2017 18:53:23 +0100 Subject: udp_io, traceroute: Standardise IPv6 PKTINFO handling to be portable The current standard (RFC 3542) is for IPV6_RECVPKTINFO to be given to setsockopt, and IPV6_PKTINFO to be used as the packet type. Previously, RFC 2292 required IPV6_PKTINFO to be used for both, but RFC 3542 re-purposed IPV6_PKTINFO when given to setsockopt. The special Linux-specific IPV6_2292PKTINFO has the same semantics as IPV6_PKTINFO in RFC 2292, but was introduced at the same time as IPV6_RECVPKTINFO. Therefore, if we have IPV6_RECVPKTINFO available, we can use the RFC 3542 style, and if not, we assume that only the RFC 2292 API is available, using IPV6_PKTINFO for both. Signed-off-by: James Clarke Signed-off-by: Denys Vlasenko --- libbb/udp_io.c | 8 ++++++-- networking/traceroute.c | 8 +++----- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'libbb') 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 @@ */ #include "libbb.h" +#if defined(IPV6_PKTINFO) && !defined(IPV6_RECVPKTINFO) +# define IPV6_RECVPKTINFO IPV6_PKTINFO +#endif + /* * This asks kernel to let us know dst addr/port of incoming packets * We don't check for errors here. Not supported == won't be used @@ -18,8 +22,8 @@ socket_want_pktinfo(int fd UNUSED_PARAM) #ifdef IP_PKTINFO setsockopt_1(fd, IPPROTO_IP, IP_PKTINFO); #endif -#if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO) - setsockopt_1(fd, IPPROTO_IPV6, IPV6_PKTINFO); +#if ENABLE_FEATURE_IPV6 && defined(IPV6_RECVPKTINFO) + setsockopt_1(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO); #endif } diff --git a/networking/traceroute.c b/networking/traceroute.c index df7122047..6dcbc2faa 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -311,6 +311,9 @@ # ifndef SOL_IPV6 # define SOL_IPV6 IPPROTO_IPV6 # endif +# if defined(IPV6_PKTINFO) && !defined(IPV6_RECVPKTINFO) +# define IPV6_RECVPKTINFO IPV6_PKTINFO +# endif #endif #include "libbb.h" @@ -911,12 +914,7 @@ common_traceroute_main(int op, char **argv) #if ENABLE_TRACEROUTE6 if (af == AF_INET6) { xmove_fd(xsocket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6), rcvsock); -# ifdef IPV6_RECVPKTINFO setsockopt_1(rcvsock, SOL_IPV6, IPV6_RECVPKTINFO); - setsockopt_1(rcvsock, SOL_IPV6, IPV6_2292PKTINFO); -# else - setsockopt_1(rcvsock, SOL_IPV6, IPV6_PKTINFO); -# endif } else #endif { -- cgit v1.2.3-55-g6feb