From 51ca7761a3579f3c3f7e771b39019e6e248a5171 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 16 Jul 2010 17:16:40 +0200 Subject: cttyhack: move build system bits into cttyhack.c, no code changes Signed-off-by: Denys Vlasenko --- shell/Config.src | 36 ------------------------------------ shell/Kbuild.src | 1 - shell/ash.c | 1 + shell/cttyhack.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 37 deletions(-) (limited to 'shell') diff --git a/shell/Config.src b/shell/Config.src index 6389d943a..f6f0b6c94 100644 --- a/shell/Config.src +++ b/shell/Config.src @@ -158,40 +158,4 @@ config FEATURE_SH_NOFORK This feature is relatively new. Use with care. -config CTTYHACK - bool "cttyhack" - default y - help - One common problem reported on the mailing list is "can't access tty; - job control turned off" error message which typically appears when - one tries to use shell with stdin/stdout opened to /dev/console. - This device is special - it cannot be a controlling tty. - - Proper solution is to use correct device instead of /dev/console. - - cttyhack provides "quick and dirty" solution to this problem. - It analyzes stdin with various ioctls, trying to determine whether - it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line). - If it detects one, it closes stdin/out/err and reopens that device. - Then it executes given program. Opening the device will make - that device a controlling tty. This may require cttyhack - to be a session leader. - - Example for /etc/inittab (for busybox init): - - ::respawn:/bin/cttyhack /bin/sh - - Starting an interactive shell from boot shell script: - - setsid cttyhack sh - - Giving controlling tty to shell running with PID 1: - - # exec cttyhack sh - - Without cttyhack, you need to know exact tty name, - and do something like this: - - # exec setsid sh -c 'exec sh /dev/tty1 2>&1' - endmenu diff --git a/shell/Kbuild.src b/shell/Kbuild.src index bce99240f..a669bdfb0 100644 --- a/shell/Kbuild.src +++ b/shell/Kbuild.src @@ -8,5 +8,4 @@ lib-y:= INSERT -lib-$(CONFIG_CTTYHACK) += cttyhack.o lib-$(CONFIG_SH_MATH_SUPPORT) += math.o diff --git a/shell/ash.c b/shell/ash.c index 9b33e78ec..fd119fa51 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -179,6 +179,7 @@ //config: "PS#" may contain volatile content, such as backquote commands. //config: This option recreates the prompt string from the environment //config: variable each time it is displayed. +//config: //usage:#define ash_trivial_usage NOUSAGE_STR //usage:#define ash_full_usage "" diff --git a/shell/cttyhack.c b/shell/cttyhack.c index 67736ad62..7af13fdfd 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c @@ -6,6 +6,58 @@ */ #include "libbb.h" +//applet:IF_CTTYHACK(APPLET(cttyhack, _BB_DIR_BIN, _BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CTTYHACK) += cttyhack.o + +//config:config CTTYHACK +//config: bool "cttyhack" +//config: default y +//config: help +//config: One common problem reported on the mailing list is "can't access tty; +//config: job control turned off" error message which typically appears when +//config: one tries to use shell with stdin/stdout opened to /dev/console. +//config: This device is special - it cannot be a controlling tty. +//config: +//config: Proper solution is to use correct device instead of /dev/console. +//config: +//config: cttyhack provides "quick and dirty" solution to this problem. +//config: It analyzes stdin with various ioctls, trying to determine whether +//config: it is a /dev/ttyN or /dev/ttySN (virtual terminal or serial line). +//config: If it detects one, it closes stdin/out/err and reopens that device. +//config: Then it executes given program. Opening the device will make +//config: that device a controlling tty. This may require cttyhack +//config: to be a session leader. +//config: +//config: Example for /etc/inittab (for busybox init): +//config: +//config: ::respawn:/bin/cttyhack /bin/sh +//config: +//config: Starting an interactive shell from boot shell script: +//config: +//config: setsid cttyhack sh +//config: +//config: Giving controlling tty to shell running with PID 1: +//config: +//config: # exec cttyhack sh +//config: +//config: Without cttyhack, you need to know exact tty name, +//config: and do something like this: +//config: +//config: # exec setsid sh -c 'exec sh /dev/tty1 2>&1' +//config: + +//usage:#define cttyhack_trivial_usage +//usage: "PROG ARGS" +//usage:#define cttyhack_full_usage "\n\n" +//usage: "Give PROG a controlling tty if possible." +//usage: "\nExample for /etc/inittab (for busybox init):" +//usage: "\n ::respawn:/bin/cttyhack /bin/sh" +//usage: "\nGiving controlling tty to shell running with PID 1:" +//usage: "\n $ exec cttyhack sh" +//usage: "\nStarting interactive shell from boot shell script:" +//usage: "\n setsid cttyhack sh" + /* From */ struct vt_stat { unsigned short v_active; /* active vt */ -- cgit v1.2.3-55-g6feb From 6adf2aad38cf2f5a056f9014955807607bcb41b2 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 16 Jul 2010 19:26:38 +0200 Subject: hush: move msh/lash config into hush.c, no code changes Signed-off-by: Denys Vlasenko --- shell/Config.src | 23 ----------------------- shell/hush.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 23 deletions(-) (limited to 'shell') diff --git a/shell/Config.src b/shell/Config.src index f6f0b6c94..c9c2439e7 100644 --- a/shell/Config.src +++ b/shell/Config.src @@ -62,29 +62,6 @@ config FEATURE_BASH_IS_NONE endchoice -config LASH - bool "lash (deprecated: aliased to hush)" - default n - select HUSH - help - lash is deprecated and will be removed, please migrate to hush. - -config MSH - bool "msh (deprecated: please use hush)" - default n - select HUSH - help - msh is deprecated and will be removed, please migrate to hush. - If there is a feature msh has but hush does not, please let us know. - -# The minix shell (adds just 30k) is quite complete and handles things -# like for/do/done, case/esac and all the things you expect a Bourne -# shell to do. It is not always pedantically correct about Bourne -# shell grammar (try running the shell testscript "tests/sh.testcases" -# on it and compare vs bash) but for most things it works quite well. -# It uses only vfork, so it can be used on uClinux systems. - - config SH_MATH_SUPPORT bool "POSIX math support" default y diff --git a/shell/hush.c b/shell/hush.c index 56a3f4b14..9208ec497 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -224,6 +224,20 @@ //config: This instructs hush to print commands before execution. //config: Adds ~300 bytes. //config: +//config:config LASH +//config: bool "lash (deprecated: aliased to hush)" +//config: default n +//config: select HUSH +//config: help +//config: lash is deprecated and will be removed, please migrate to hush. +//config: +//config:config MSH +//config: bool "msh (deprecated: aliased to hush)" +//config: default n +//config: select HUSH +//config: help +//config: msh is deprecated and will be removed, please migrate to hush. +//config: //usage:#define hush_trivial_usage NOUSAGE_STR //usage:#define hush_full_usage "" -- cgit v1.2.3-55-g6feb From 1d7266d3b59be361763dab61f680103bbb70f3e9 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Mon, 19 Jul 2010 00:44:56 +0200 Subject: mark Linux-specific configuration options PLATFORM_LINUX is used as a dependency for applets or features which require Linux-specific interfaces. Signed-off-by: Jeremie Koenig Signed-off-by: Denys Vlasenko --- Config.in | 12 ++++++++++++ console-tools/Config.src | 13 +++++++++++++ coreutils/Config.src | 2 ++ coreutils/date.c | 2 +- e2fsprogs/Config.src | 1 + init/Config.src | 2 ++ init/bootchartd.c | 1 + libbb/Config.src | 1 + loginutils/Config.src | 3 +++ miscutils/Config.src | 19 ++++++++++++++++++- miscutils/conspy.c | 1 + miscutils/ubi_attach_detach.c | 2 ++ modutils/Config.src | 1 + networking/Config.src | 23 ++++++++++++++++++++++- networking/udhcp/Config.src | 2 ++ procps/Config.src | 4 +++- shell/cttyhack.c | 1 + sysklogd/Config.src | 1 + util-linux/Config.src | 27 +++++++++++++++++++++++++++ 19 files changed, 114 insertions(+), 4 deletions(-) (limited to 'shell') diff --git a/Config.in b/Config.in index eebc9774d..35f43b3cd 100644 --- a/Config.in +++ b/Config.in @@ -47,6 +47,17 @@ config USE_PORTABLE_CODE compiler other than gcc. If you do use gcc, this option may needlessly increase code size. +config PLATFORM_LINUX + bool "Enable Linux-specific applets and features" + default y + help + For the most part, busybox requires only POSIX compatibility + from the target system, but some applets and features use + Linux-specific interfaces. + + Answering 'N' here will disable such applets and hide the + corresponding configuration options. + choice prompt "Buffer allocation policy" default FEATURE_BUFFERS_USE_MALLOC @@ -353,6 +364,7 @@ config FEATURE_SUID_CONFIG_QUIET config SELINUX bool "Support NSA Security Enhanced Linux" default n + depends on PLATFORM_LINUX help Enable support for SELinux in applets ls, ps, and id. Also provide the option of compiling in SELinux applets. diff --git a/console-tools/Config.src b/console-tools/Config.src index 6e3191ada..cdb26800e 100644 --- a/console-tools/Config.src +++ b/console-tools/Config.src @@ -10,6 +10,7 @@ INSERT config CHVT bool "chvt" default y + depends on PLATFORM_LINUX help This program is used to change to another terminal. Example: chvt 4 (change to terminal /dev/tty4) @@ -17,6 +18,7 @@ config CHVT config FGCONSOLE bool "fgconsole" default y + depends on PLATFORM_LINUX help This program prints active (foreground) console number. @@ -29,12 +31,14 @@ config CLEAR config DEALLOCVT bool "deallocvt" default y + depends on PLATFORM_LINUX help This program deallocates unused virtual consoles. config DUMPKMAP bool "dumpkmap" default y + depends on PLATFORM_LINUX help This program dumps the kernel's keyboard translation table to stdout, in binary format. You can then use loadkmap to load it. @@ -42,18 +46,21 @@ config DUMPKMAP config KBD_MODE bool "kbd_mode" default y + depends on PLATFORM_LINUX help This program reports and sets keyboard mode. config LOADFONT bool "loadfont" default y + depends on PLATFORM_LINUX help This program loads a console font from standard input. config LOADKMAP bool "loadkmap" default y + depends on PLATFORM_LINUX help This program loads a keyboard translation table from standard input. @@ -61,6 +68,7 @@ config LOADKMAP config OPENVT bool "openvt" default y + depends on PLATFORM_LINUX help This program is used to start a command on an unused virtual terminal. @@ -92,6 +100,7 @@ config FEATURE_RESIZE_PRINT config SETCONSOLE bool "setconsole" default y + depends on PLATFORM_LINUX help This program redirects the system console to another device, like the current tty while logged in via telnet. @@ -106,6 +115,7 @@ config FEATURE_SETCONSOLE_LONG_OPTIONS config SETFONT bool "setfont" default y + depends on PLATFORM_LINUX help Allows to load console screen map. Useful for i18n. @@ -127,6 +137,7 @@ config DEFAULT_SETFONT_DIR config SETKEYCODES bool "setkeycodes" default y + depends on PLATFORM_LINUX help This program loads entries into the kernel's scancode-to-keycode map, allowing unusual keyboards to generate usable keycodes. @@ -134,12 +145,14 @@ config SETKEYCODES config SETLOGCONS bool "setlogcons" default y + depends on PLATFORM_LINUX help This program redirects the output console of kernel messages. config SHOWKEY bool "showkey" default y + depends on PLATFORM_LINUX help Shows keys pressed. diff --git a/coreutils/Config.src b/coreutils/Config.src index d4c9e0541..780b73fda 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src @@ -591,6 +591,7 @@ config FEATURE_SPLIT_FANCY config STAT bool "stat" default y + depends on PLATFORM_LINUX # statfs() help display file or filesystem status. @@ -606,6 +607,7 @@ config FEATURE_STAT_FORMAT config STTY bool "stty" default y + depends on PLATFORM_LINUX help stty is used to change and print terminal line settings. diff --git a/coreutils/date.c b/coreutils/date.c index c737f09f3..cb41724af 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -72,7 +72,7 @@ //config:config FEATURE_DATE_NANO //config: bool "Support %[num]N nanosecond format specifier" //config: default n -//config: depends on DATE +//config: depends on DATE && PLATFORM_LINUX # syscall(__NR_clock_gettime) //config: help //config: Support %[num]N format specifier. Adds ~250 bytes of code. //config: diff --git a/e2fsprogs/Config.src b/e2fsprogs/Config.src index 62bc810f8..6043e9b57 100644 --- a/e2fsprogs/Config.src +++ b/e2fsprogs/Config.src @@ -33,6 +33,7 @@ config FSCK config LSATTR bool "lsattr" default y + depends on PLATFORM_LINUX help lsattr lists the file attributes on a second extended file system. diff --git a/init/Config.src b/init/Config.src index 590e29890..a5e76be6a 100644 --- a/init/Config.src +++ b/init/Config.src @@ -10,6 +10,7 @@ INSERT config INIT bool "init" default y + depends on PLATFORM_LINUX select FEATURE_SYSLOG help init is the first program run when the system boots. @@ -92,6 +93,7 @@ config FEATURE_INITRD config HALT bool "poweroff, halt, and reboot" default y + depends on PLATFORM_LINUX help Stop all processes and either halt, reboot, or power off the system. diff --git a/init/bootchartd.c b/init/bootchartd.c index dae2fe6e9..a1c01641b 100644 --- a/init/bootchartd.c +++ b/init/bootchartd.c @@ -6,6 +6,7 @@ //config:config BOOTCHARTD //config: bool "bootchartd" //config: default y +//config: depends on PLATFORM_LINUX //config: help //config: bootchartd is commonly used to profile the boot process //config: for the purpose of speeding it up. In this case, it is started diff --git a/libbb/Config.src b/libbb/Config.src index 09bf89246..9b01757c6 100644 --- a/libbb/Config.src +++ b/libbb/Config.src @@ -153,6 +153,7 @@ config FEATURE_COPYBUF_KB config MONOTONIC_SYSCALL bool "Use clock_gettime(CLOCK_MONOTONIC) syscall" default n + depends on PLATFORM_LINUX help Use clock_gettime(CLOCK_MONOTONIC) syscall for measuring time intervals (time, ping, traceroute etc need this). diff --git a/loginutils/Config.src b/loginutils/Config.src index 5d497c4dc..425d041b9 100644 --- a/loginutils/Config.src +++ b/loginutils/Config.src @@ -179,6 +179,7 @@ config DELUSER config GETTY bool "getty" default y + depends on PLATFORM_LINUX select FEATURE_SYSLOG help getty lets you log in on a tty, it is normally invoked by init. @@ -186,6 +187,7 @@ config GETTY config LOGIN bool "login" default y + depends on PLATFORM_LINUX select FEATURE_SUID select FEATURE_SYSLOG help @@ -295,6 +297,7 @@ config SULOGIN config VLOCK bool "vlock" default y + depends on PLATFORM_LINUX select FEATURE_SUID help Build the "vlock" applet which allows you to lock (virtual) terminals. diff --git a/miscutils/Config.src b/miscutils/Config.src index 2f7c50271..e89e231e6 100644 --- a/miscutils/Config.src +++ b/miscutils/Config.src @@ -10,6 +10,7 @@ INSERT config ADJTIMEX bool "adjtimex" default y + depends on PLATFORM_LINUX help Adjtimex reads and optionally sets adjustment parameters for the Linux clock adjustment algorithm. @@ -24,6 +25,7 @@ config BBCONFIG config BEEP bool "beep" default y + depends on PLATFORM_LINUX help The beep applets beeps in a given freq/Hz. @@ -180,6 +182,7 @@ config FEATURE_DC_LIBM config DEVFSD bool "devfsd (obsolete)" default n + depends on PLATFORM_LINUX select FEATURE_SYSLOG help This is deprecated and should NOT be used anymore. @@ -223,6 +226,7 @@ config DEVFSD_VERBOSE config FEATURE_DEVFS bool "Use devfs names for all devices (obsolete)" default n + depends on PLATFORM_LINUX help This is obsolete and should NOT be used anymore. Use linux >= 2.6 (optionally with hotplug) and mdev instead! @@ -242,6 +246,7 @@ config DEVMEM config EJECT bool "eject" default y + depends on PLATFORM_LINUX help Used to eject cdroms. (defaults to /dev/cdrom) @@ -256,6 +261,7 @@ config FEATURE_EJECT_SCSI config FBSPLASH bool "fbsplash" default y + depends on PLATFORM_LINUX help Shows splash image and progress bar on framebuffer device. Can be used during boot phase of an embedded device. ~2kb. @@ -305,6 +311,7 @@ config FLASH_ERASEALL config IONICE bool "ionice" default y + depends on PLATFORM_LINUX help Set/set program io scheduling class and priority Requires kernel >= 2.6.13 @@ -344,6 +351,11 @@ endchoice config LESS bool "less" default y + depends on PLATFORM_LINUX + depends on PLATFORM_LINUX + depends on PLATFORM_LINUX + depends on PLATFORM_LINUX + depends on PLATFORM_LINUX help 'less' is a pager, meaning that it displays text files. It possesses a wide array of features, and is an improvement over 'more'. @@ -410,6 +422,7 @@ config FEATURE_LESS_LINENUMS config HDPARM bool "hdparm" default y + depends on PLATFORM_LINUX help Get/Set hard drive parameters. Primarily intended for ATA drives. Adds about 13k (or around 30k if you enable the @@ -526,6 +539,7 @@ config MT config RAIDAUTORUN bool "raidautorun" default y + depends on PLATFORM_LINUX help raidautorun tells the kernel md driver to search and start RAID arrays. @@ -533,7 +547,7 @@ config RAIDAUTORUN config READAHEAD bool "readahead" default y - depends on LFS + depends on LFS && PLATFORM_LINUX help Preload the files listed on the command line into RAM cache so that subsequent reads on these files will not block on disk I/O. @@ -550,6 +564,7 @@ config READAHEAD config RFKILL bool "rfkill" default n # doesn't build on Ubuntu 9.04 + depends on PLATFORM_LINUX help Enable/disable wireless devices. @@ -570,6 +585,7 @@ config RUNLEVEL config RX bool "rx" default y + depends on PLATFORM_LINUX help Receive files using the Xmodem protocol. @@ -641,6 +657,7 @@ config WALL config WATCHDOG bool "watchdog" default y + depends on PLATFORM_LINUX help The watchdog utility is used with hardware or software watchdog device drivers. It opens the specified watchdog device special file diff --git a/miscutils/conspy.c b/miscutils/conspy.c index 509a0f271..a173d8efd 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c @@ -17,6 +17,7 @@ //config:config CONSPY //config: bool "conspy" //config: default n +//config: depends on PLATFORM_LINUX //config: help //config: A text-mode VNC like program for Linux virtual terminals. //config: example: conspy NUM shared access to console num diff --git a/miscutils/ubi_attach_detach.c b/miscutils/ubi_attach_detach.c index 7b92a8afc..0d63a10d5 100644 --- a/miscutils/ubi_attach_detach.c +++ b/miscutils/ubi_attach_detach.c @@ -12,12 +12,14 @@ //config:config UBIATTACH //config: bool "ubiattach" //config: default n +//config: depends on PLATFORM_LINUX //config: help //config: Attach MTD device to an UBI device. //config: //config:config UBIDETACH //config: bool "ubidetach" //config: default n +//config: depends on PLATFORM_LINUX //config: help //config: Detach MTD device from an UBI device. diff --git a/modutils/Config.src b/modutils/Config.src index a7dcb3ab3..4191d29f2 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -4,6 +4,7 @@ # menu "Linux Module Utilities" +depends on PLATFORM_LINUX INSERT diff --git a/networking/Config.src b/networking/Config.src index 449436247..26c59e7c1 100644 --- a/networking/Config.src +++ b/networking/Config.src @@ -43,6 +43,7 @@ config FEATURE_PREFER_IPV4_ADDRESS config VERBOSE_RESOLUTION_ERRORS bool "Verbose resolution errors" default n + depends on PLATFORM_LINUX #because of xsocket() in libbb/xfuncs_prinf.c help Enable if you are not satisfied with simplistic "can't resolve 'hostname.com'" and want to know more. @@ -51,18 +52,21 @@ config VERBOSE_RESOLUTION_ERRORS config ARP bool "arp" default y + depends on PLATFORM_LINUX help Manipulate the system ARP cache. config ARPING bool "arping" default y + depends on PLATFORM_LINUX help Ping hosts by ARP packets. config BRCTL bool "brctl" default y + depends on PLATFORM_LINUX help Manage ethernet bridges. Supports addbr/delbr and addif/delif. @@ -95,6 +99,7 @@ config DNSD config ETHER_WAKE bool "ether-wake" default y + depends on PLATFORM_LINUX help Send a magic packet to wake up sleeping machines. @@ -269,6 +274,7 @@ config FEATURE_HTTPD_PROXY config IFCONFIG bool "ifconfig" default y + depends on PLATFORM_LINUX help Ifconfig is used to configure the kernel-resident network interfaces. @@ -316,6 +322,7 @@ config FEATURE_IFCONFIG_BROADCAST_PLUS config IFENSLAVE bool "ifenslave" default y + depends on PLATFORM_LINUX help Userspace application to bind several interfaces to a logical interface (use with kernel bonding driver). @@ -323,6 +330,7 @@ config IFENSLAVE config IFPLUGD bool "ifplugd" default y + depends on PLATFORM_LINUX help Network interface plug detection daemon. @@ -364,7 +372,7 @@ config FEATURE_IFUPDOWN_IP config FEATURE_IFUPDOWN_IP_BUILTIN bool "Use busybox ip applet" default y - depends on FEATURE_IFUPDOWN_IP + depends on FEATURE_IFUPDOWN_IP && PLATFORM_LINUX select IP select FEATURE_IP_ADDRESS select FEATURE_IP_LINK @@ -483,6 +491,7 @@ config FEATURE_INETD_RPC config IP bool "ip" default y + depends on PLATFORM_LINUX help The "ip" applet is a TCP/IP interface configuration and routing utility. You generally don't need "ip" to use busybox with @@ -598,6 +607,7 @@ config FEATURE_IPCALC_LONG_OPTIONS config NAMEIF bool "nameif" default y + depends on PLATFORM_LINUX select FEATURE_SYSLOG help nameif is used to rename network interface by its MAC address. @@ -626,6 +636,7 @@ config FEATURE_NAMEIF_EXTENDED config NETSTAT bool "netstat" default y + depends on PLATFORM_LINUX help netstat prints information about the Linux networking subsystem. @@ -654,6 +665,7 @@ config NSLOOKUP config NTPD bool "ntpd" default y + depends on PLATFORM_LINUX help The NTP client/server daemon. @@ -668,6 +680,7 @@ config FEATURE_NTPD_SERVER config PING bool "ping" default y + depends on PLATFORM_LINUX help ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. @@ -696,12 +709,14 @@ config PSCAN config ROUTE bool "route" default y + depends on PLATFORM_LINUX help Route displays or manipulates the kernel's IP routing tables. config SLATTACH bool "slattach" default y + depends on PLATFORM_LINUX help slattach is a small utility to attach network interfaces to serial lines. @@ -719,6 +734,7 @@ config SLATTACH config TCPSVD bool "tcpsvd" default y + depends on PLATFORM_LINUX help tcpsvd listens on a TCP port and runs a program for each new connection. @@ -888,6 +904,7 @@ config TFTP_DEBUG config TRACEROUTE bool "traceroute" default y + depends on PLATFORM_LINUX help Utility to trace the route of IP packets. @@ -924,6 +941,7 @@ config FEATURE_TRACEROUTE_USE_ICMP config TUNCTL bool "tunctl" default y + depends on PLATFORM_LINUX help tunctl creates or deletes tun devices. @@ -949,6 +967,7 @@ config IFUPDOWN_UDHCPC_CMD_OPTIONS config UDPSVD bool "udpsvd" default y + depends on PLATFORM_LINUX help udpsvd listens on an UDP port and runs a program for each new connection. @@ -956,6 +975,7 @@ config UDPSVD config VCONFIG bool "vconfig" default y + depends on PLATFORM_LINUX help Creates, removes, and configures VLAN interfaces @@ -990,6 +1010,7 @@ config FEATURE_WGET_LONG_OPTIONS config ZCIP bool "zcip" default y + depends on PLATFORM_LINUX select FEATURE_SYSLOG help ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927. diff --git a/networking/udhcp/Config.src b/networking/udhcp/Config.src index aac88569b..331dffc2e 100644 --- a/networking/udhcp/Config.src +++ b/networking/udhcp/Config.src @@ -8,6 +8,7 @@ INSERT config UDHCPD bool "udhcp server (udhcpd)" default y + depends on PLATFORM_LINUX help udhcpd is a DHCP server geared primarily toward embedded systems, while striving to be fully functional and RFC compliant. @@ -51,6 +52,7 @@ config DHCPD_LEASES_FILE config UDHCPC bool "udhcp client (udhcpc)" default y + depends on PLATFORM_LINUX help udhcpc is a DHCP client geared primarily toward embedded systems, while striving to be fully functional and RFC compliant. diff --git a/procps/Config.src b/procps/Config.src index e61de5614..1ff6dfd30 100644 --- a/procps/Config.src +++ b/procps/Config.src @@ -10,6 +10,7 @@ INSERT config FREE bool "free" default y + depends on PLATFORM_LINUX #sysinfo() help free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. @@ -104,7 +105,7 @@ config FEATURE_PS_WIDE config FEATURE_PS_TIME bool "Enable time and elapsed time output" default y - depends on PS && DESKTOP + depends on PS && DESKTOP && PLATFORM_LINUX #sysinfo() help Support -o time and -o etime output specifiers. @@ -200,6 +201,7 @@ config FEATURE_SHOW_THREADS config UPTIME bool "uptime" default y + depends on PLATFORM_LINUX #sysinfo() help uptime gives a one line display of the current time, how long the system has been running, how many users are currently logged diff --git a/shell/cttyhack.c b/shell/cttyhack.c index 7af13fdfd..a80d49dc3 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c @@ -13,6 +13,7 @@ //config:config CTTYHACK //config: bool "cttyhack" //config: default y +//config: depends on PLATFORM_LINUX //config: help //config: One common problem reported on the mailing list is "can't access tty; //config: job control turned off" error message which typically appears when diff --git a/sysklogd/Config.src b/sysklogd/Config.src index 6d574abb1..bfe2d1cc3 100644 --- a/sysklogd/Config.src +++ b/sysklogd/Config.src @@ -109,6 +109,7 @@ config FEATURE_LOGREAD_REDUCED_LOCKING config KLOGD bool "klogd" default y + depends on PLATFORM_LINUX help klogd is a utility which intercepts and logs all messages from the Linux kernel and sends the messages diff --git a/util-linux/Config.src b/util-linux/Config.src index 91d1fc2ce..98953c17b 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -10,6 +10,7 @@ INSERT config ACPID bool "acpid" default y + depends on PLATFORM_LINUX help acpid listens to ACPI events coming either in textual form from /proc/acpi/event (though it is marked deprecated it is still widely @@ -32,6 +33,7 @@ config FEATURE_ACPID_COMPAT config BLKID bool "blkid" default y + depends on PLATFORM_LINUX select VOLUMEID help Lists labels and UUIDs of all filesystems. @@ -41,6 +43,7 @@ config BLKID config DMESG bool "dmesg" default y + depends on PLATFORM_LINUX help dmesg is used to examine or control the kernel ring buffer. When the Linux kernel prints messages to the system log, they are stored in @@ -74,6 +77,7 @@ config FEATURE_DMESG_PRETTY config FBSET bool "fbset" default y + depends on PLATFORM_LINUX help fbset is used to show or change the settings of a Linux frame buffer device. The frame buffer device provides a simple and unique @@ -102,6 +106,7 @@ config FEATURE_FBSET_READMODE config FDFLUSH bool "fdflush" default y + depends on PLATFORM_LINUX help fdflush is only needed when changing media on slightly-broken removable media drives. It is used to make Linux believe that a @@ -114,12 +119,14 @@ config FDFLUSH config FDFORMAT bool "fdformat" default y + depends on PLATFORM_LINUX help fdformat is used to low-level format a floppy disk. config FDISK bool "fdisk" default y + depends on PLATFORM_LINUX help The fdisk utility is used to divide hard disks into one or more logical disks, which are generally called partitions. This utility @@ -187,6 +194,7 @@ config FEATURE_FDISK_ADVANCED config FINDFS bool "findfs" default y + depends on PLATFORM_LINUX select VOLUMEID help Prints the name of a filesystem with given label or UUID. @@ -202,6 +210,7 @@ config FLOCK config FREERAMDISK bool "freeramdisk" default y + depends on PLATFORM_LINUX help Linux allows you to create ramdisks. This utility allows you to delete them and completely free all memory that was used for the @@ -224,12 +233,14 @@ config FSCK_MINIX config MKFS_EXT2 bool "mkfs_ext2" default y + depends on PLATFORM_LINUX help Utility to create EXT2 filesystems. config MKFS_MINIX bool "mkfs_minix" default y + depends on PLATFORM_LINUX help The minix filesystem is a nice, small, compact, read-write filesystem with little overhead. If you wish to be able to create minix @@ -247,6 +258,7 @@ config FEATURE_MINIX2 config MKFS_REISER bool "mkfs_reiser" default n + depends on PLATFORM_LINUX help Utility to create ReiserFS filesystems. Note: this applet needs a lot of testing and polishing. @@ -254,6 +266,7 @@ config MKFS_REISER config MKFS_VFAT bool "mkfs_vfat" default y + depends on PLATFORM_LINUX help Utility to create FAT32 filesystems. @@ -302,6 +315,7 @@ config HD config HWCLOCK bool "hwclock" default y + depends on PLATFORM_LINUX help The hwclock utility is used to read and set the hardware clock on a system. This is primarily used to set the current time on @@ -341,6 +355,7 @@ config IPCRM config IPCS bool "ipcs" default y + depends on PLATFORM_LINUX select FEATURE_SUID help The ipcs utility is used to provide information on the currently @@ -349,6 +364,7 @@ config IPCS config LOSETUP bool "losetup" default y + depends on PLATFORM_LINUX help losetup is used to associate or detach a loop device with a regular file or block device, and to query the status of a loop device. This @@ -357,6 +373,7 @@ config LOSETUP config LSPCI bool "lspci" default y + #depends on PLATFORM_LINUX help lspci is a utility for displaying information about PCI buses in the system and devices connected to them. @@ -366,6 +383,7 @@ config LSPCI config LSUSB bool "lsusb" default y + #depends on PLATFORM_LINUX help lsusb is a utility for displaying information about USB buses in the system and devices connected to them. @@ -375,6 +393,7 @@ config LSUSB config MDEV bool "mdev" default y + depends on PLATFORM_LINUX help mdev is a mini-udev implementation for dynamically creating device nodes in the /dev directory. @@ -473,6 +492,7 @@ config FEATURE_USE_TERMIOS config MOUNT bool "mount" default y + depends on PLATFORM_LINUX help All files and filesystems in Unix are arranged into one big directory tree. The 'mount' utility is used to graft a filesystem onto a @@ -555,6 +575,7 @@ config FEATURE_MOUNT_FSTAB config PIVOT_ROOT bool "pivot_root" default y + depends on PLATFORM_LINUX help The pivot_root utility swaps the mount points for the root filesystem with some other mounted filesystem. This allows you to do all sorts @@ -582,12 +603,14 @@ config RDEV config READPROFILE bool "readprofile" default y + #depends on PLATFORM_LINUX help This allows you to parse /proc/profile for basic profiling. config RTCWAKE bool "rtcwake" default y + depends on PLATFORM_LINUX help Enter a system sleep state until specified wakeup time. @@ -607,6 +630,7 @@ config SCRIPTREPLAY config SETARCH bool "setarch" default y + depends on PLATFORM_LINUX help The linux32 utility is used to create a 32bit environment for the specified program (usually a shell). It only makes sense to have @@ -616,6 +640,7 @@ config SETARCH config SWAPONOFF bool "swaponoff" default y + depends on PLATFORM_LINUX help This option enables both the 'swapon' and the 'swapoff' utilities. Once you have created some swap space using 'mkswap', you also need @@ -634,6 +659,7 @@ config FEATURE_SWAPON_PRI config SWITCH_ROOT bool "switch_root" default y + depends on PLATFORM_LINUX help The switch_root utility is used from initramfs to select a new root device. Under initramfs, you have to use this instead of @@ -653,6 +679,7 @@ config SWITCH_ROOT config UMOUNT bool "umount" default y + depends on PLATFORM_LINUX help When you want to remove a mounted filesystem from its current mount point, for example when you are shutting down the system, the -- cgit v1.2.3-55-g6feb From ccb977186100ccf6b443c5f08c8b179c9b7e720b Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Sun, 25 Jul 2010 13:07:39 +0200 Subject: ash: fix $! value when traps are set Signed-off-by: Alexander Shishkin Signed-off-by: Denys Vlasenko --- shell/ash.c | 1 + shell/ash_test/ash-signals/signal7.right | 1 + shell/ash_test/ash-signals/signal7.tests | 18 ++++++++++++++++++ shell/hush.c | 4 ++-- shell/hush_test/hush-trap/signal7.right | 1 + shell/hush_test/hush-trap/signal7.tests | 18 ++++++++++++++++++ 6 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 shell/ash_test/ash-signals/signal7.right create mode 100755 shell/ash_test/ash-signals/signal7.tests create mode 100644 shell/hush_test/hush-trap/signal7.right create mode 100755 shell/hush_test/hush-trap/signal7.tests (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index fd119fa51..988edab8a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -4633,6 +4633,7 @@ clear_traps(void) INT_ON; } } + may_have_traps = 0; } /* Lives far away from here, needed for forkchild */ diff --git a/shell/ash_test/ash-signals/signal7.right b/shell/ash_test/ash-signals/signal7.right new file mode 100644 index 000000000..ba7453e42 --- /dev/null +++ b/shell/ash_test/ash-signals/signal7.right @@ -0,0 +1 @@ +Bug detected: 0 diff --git a/shell/ash_test/ash-signals/signal7.tests b/shell/ash_test/ash-signals/signal7.tests new file mode 100755 index 000000000..c2b1381f9 --- /dev/null +++ b/shell/ash_test/ash-signals/signal7.tests @@ -0,0 +1,18 @@ +bug() { + trap : exit + # Bug was causing sh to be run in subshell, + # as if this line is replaced with (sh -c ...; exit $?) & + # here: + sh -c 'echo REAL_CHILD=$$' & + echo PARENTS_IDEA_OF_CHILD=$! + wait # make sure bkgd shell completes +} + +bug | { +while read varval; do + eval $varval +done +test x"$REAL_CHILD" != x"" \ +&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD" +echo "Bug detected: $?" +} diff --git a/shell/hush.c b/shell/hush.c index 9208ec497..45c98bb36 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4108,8 +4108,6 @@ static void insert_bg_job(struct pipe *pi) if (G_interactive_fd) printf("[%d] %d %s\n", job->jobid, job->cmds[0].pid, job->cmdtext); - /* Last command's pid goes to $! */ - G.last_bg_pid = job->cmds[job->num_cmds - 1].pid; G.last_jobid = job->jobid; } @@ -5076,6 +5074,8 @@ static int run_list(struct pipe *pi) if (G.run_list_level == 1) insert_bg_job(pi); #endif + /* Last command's pid goes to $! */ + G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid; G.last_exitcode = rcode = EXIT_SUCCESS; debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n"); } else { diff --git a/shell/hush_test/hush-trap/signal7.right b/shell/hush_test/hush-trap/signal7.right new file mode 100644 index 000000000..ba7453e42 --- /dev/null +++ b/shell/hush_test/hush-trap/signal7.right @@ -0,0 +1 @@ +Bug detected: 0 diff --git a/shell/hush_test/hush-trap/signal7.tests b/shell/hush_test/hush-trap/signal7.tests new file mode 100755 index 000000000..c2b1381f9 --- /dev/null +++ b/shell/hush_test/hush-trap/signal7.tests @@ -0,0 +1,18 @@ +bug() { + trap : exit + # Bug was causing sh to be run in subshell, + # as if this line is replaced with (sh -c ...; exit $?) & + # here: + sh -c 'echo REAL_CHILD=$$' & + echo PARENTS_IDEA_OF_CHILD=$! + wait # make sure bkgd shell completes +} + +bug | { +while read varval; do + eval $varval +done +test x"$REAL_CHILD" != x"" \ +&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD" +echo "Bug detected: $?" +} -- cgit v1.2.3-55-g6feb From f3ea792badae9cd7c4205ac363301f1e94e57d4e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 26 Jul 2010 01:06:14 +0200 Subject: *: mass cosmetic removal of extra empty lines. no code changes Signed-off-by: Denys Vlasenko --- archival/bz/compress.c | 1 - archival/unzip.c | 1 - coreutils/cut.c | 1 - coreutils/expr.c | 1 - coreutils/ls.c | 2 -- e2fsprogs/old_e2fsprogs/e2fsck.c | 34 +++++++++----------------- e2fsprogs/old_e2fsprogs/ext2fs/alloc.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c | 4 --- e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c | 6 ----- e2fsprogs/old_e2fsprogs/ext2fs/bitops.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/block.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/bmap.c | 3 --- e2fsprogs/old_e2fsprogs/ext2fs/bmove.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/brel.h | 1 - e2fsprogs/old_e2fsprogs/ext2fs/closefs.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/e2image.h | 13 ---------- e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h | 1 - e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/freefs.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/inline.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/inode.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/lookup.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c | 3 --- e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/namei.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/newdir.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c | 1 - e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c | 2 -- e2fsprogs/old_e2fsprogs/ext2fs/unlink.c | 1 - e2fsprogs/old_e2fsprogs/util.c | 1 - loginutils/addgroup.c | 1 - miscutils/crond.c | 1 - miscutils/hdparm.c | 4 +-- networking/ntpd.c | 1 - networking/telnet.c | 1 - networking/traceroute.c | 1 - selinux/setfiles.c | 1 - shell/ash.c | 2 -- shell/hush.c | 1 - util-linux/fdisk.c | 1 - util-linux/volume_id/volume_id.c | 1 - 53 files changed, 13 insertions(+), 111 deletions(-) (limited to 'shell') diff --git a/archival/bz/compress.c b/archival/bz/compress.c index 640b8872b..b9b0949a9 100644 --- a/archival/bz/compress.c +++ b/archival/bz/compress.c @@ -212,7 +212,6 @@ void generateMTFValues(EState* s) wr++; s->mtfFreq[j+1]++; } - } } diff --git a/archival/unzip.c b/archival/unzip.c index 84081c021..d9705a56e 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -359,7 +359,6 @@ int unzip_main(int argc, char **argv) default: bb_show_usage(); - } break; diff --git a/coreutils/cut.c b/coreutils/cut.c index 53f343a33..696478bb2 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -37,7 +37,6 @@ static int cmpfunc(const void *a, const void *b) { return (((struct cut_list *) a)->startpos - ((struct cut_list *) b)->startpos); - } static void cut_file(FILE *file, char delim, const struct cut_list *cut_lists, unsigned nlists) diff --git a/coreutils/expr.c b/coreutils/expr.c index f40edad4e..8988340f1 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c @@ -341,7 +341,6 @@ static VALUE *eval6(void) freev(i2); } return v; - } /* Handle : operator (pattern matching). diff --git a/coreutils/ls.c b/coreutils/ls.c index 1197f7d71..3e6980509 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -52,7 +52,6 @@ enum { - TERMINAL_WIDTH = 80, /* use 79 if terminal has linefold bug */ COLUMN_GAP = 2, /* includes the file type char */ @@ -120,7 +119,6 @@ LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ SPLIT_DIR = 1, SPLIT_FILE = 0, SPLIT_SUBDIR = 2, - }; /* "[-]Cadil1", POSIX mandated options, busybox always supports */ diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 4c4c78d00..f58fe9286 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -517,7 +517,6 @@ static void dict_insert(dict_t *dict, dnode_t *node, const void *key) } dict_root(dict)->color = dnode_black; - } /* @@ -801,7 +800,6 @@ static void e2fsck_add_dx_dir(e2fsck_t ctx, ext2_ino_t ino, int num_blocks) dir->dx_block = e2fsck_allocate_memory(ctx, num_blocks * sizeof (struct dx_dirblock_info), "dx_block info array"); - } /* @@ -1724,7 +1722,6 @@ errout: ext2fs_free_mem(&j_inode); ext2fs_free_mem(&journal); return retval; - } static errcode_t e2fsck_journal_fix_bad_inode(e2fsck_t ctx, @@ -3375,7 +3372,6 @@ static void e2fsck_pass1(e2fsck_t ctx) e2fsck_write_inode(ctx, ino, inode, "pass1"); } - } /* * If dtime is set, offer to clear it. mke2fs @@ -3678,7 +3674,6 @@ endit: ext2fs_free_mem(&block_buf); ext2fs_free_mem(&inode); - } /* @@ -4451,8 +4446,7 @@ static void mark_table_blocks(e2fsck_t ctx) ctx->invalid_bitmaps++; } } else { - ext2fs_mark_block_bitmap(ctx->block_found_map, - b); + ext2fs_mark_block_bitmap(ctx->block_found_map, b); } } } @@ -4469,10 +4463,9 @@ static void mark_table_blocks(e2fsck_t ctx) ctx->invalid_bitmaps++; } } else { - ext2fs_mark_block_bitmap(ctx->block_found_map, - fs->group_desc[i].bg_block_bitmap); - } - + ext2fs_mark_block_bitmap(ctx->block_found_map, + fs->group_desc[i].bg_block_bitmap); + } } /* * Mark block used for the inode bitmap @@ -4486,8 +4479,8 @@ static void mark_table_blocks(e2fsck_t ctx) ctx->invalid_bitmaps++; } } else { - ext2fs_mark_block_bitmap(ctx->block_found_map, - fs->group_desc[i].bg_inode_bitmap); + ext2fs_mark_block_bitmap(ctx->block_found_map, + fs->group_desc[i].bg_inode_bitmap); } } block += fs->super->s_blocks_per_group; @@ -5588,7 +5581,6 @@ static void e2fsck_pass2(e2fsck_t ctx) ext2fs_mark_super_dirty(fs); } } - } #define MAX_DEPTH 32000 @@ -9748,7 +9740,6 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) if (print_answer) printf("%s.\n", answer ? _(preen_msg[(int) ptr->prompt]) : _("IGNORED")); - } if ((ptr->prompt == PROMPT_ABORT) && answer) @@ -11324,7 +11315,7 @@ static int release_inode_block(ext2_filsys fs, blk_t *block_nr, if ((blk < fs->super->s_first_data_block) || (blk >= fs->super->s_blocks_count)) { fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx); - return_abort: + return_abort: pb->abort = 1; return BLOCK_ABORT; } @@ -11537,7 +11528,7 @@ static int release_orphan_inodes(e2fsck_t ctx) } ext2fs_free_mem(&block_buf); return 0; -return_abort: + return_abort: ext2fs_free_mem(&block_buf); return 1; } @@ -11618,7 +11609,7 @@ static void check_resize_inode(e2fsck_t ctx) !(inode.i_mode & LINUX_S_IFREG) || (blk < fs->super->s_first_data_block || blk >= fs->super->s_blocks_count)) { - resize_inode_invalid: + resize_inode_invalid: if (fix_problem(ctx, PR_0_RESIZE_INODE_INVALID, &pctx)) { memset(&inode, 0, sizeof(inode)); e2fsck_write_inode(ctx, EXT2_RESIZE_INO, &inode, @@ -11660,10 +11651,9 @@ static void check_resize_inode(e2fsck_t ctx) } } -cleanup: + cleanup: ext2fs_free_mem(&dind_buf); - - } +} static void check_super_block(e2fsck_t ctx) { @@ -11842,7 +11832,6 @@ static void check_super_block(e2fsck_t ctx) (gd->bg_free_inodes_count > sb->s_inodes_per_group) || (gd->bg_used_dirs_count > sb->s_inodes_per_group)) ext2fs_unmark_valid(fs); - } /* @@ -11902,7 +11891,6 @@ static void check_super_block(e2fsck_t ctx) fs->super->s_feature_incompat &= ~EXT2_FEATURE_INCOMPAT_FILETYPE; ext2fs_mark_super_dirty(fs); - } } diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c b/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c index 5021d72c9..cbb63e15a 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c @@ -171,4 +171,3 @@ errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, } while (b != finish); return EXT2_ET_BLOCK_ALLOC_FAIL; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c b/e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c index b2d786ed8..7c60e2bf5 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c @@ -97,12 +97,9 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, fs->group_desc[group].bg_inode_table = new_blk; } - return 0; } - - errcode_t ext2fs_allocate_tables(ext2_filsys fs) { errcode_t retval; @@ -115,4 +112,3 @@ errcode_t ext2fs_allocate_tables(ext2_filsys fs) } return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c b/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c index 1deae54e8..a96789618 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c @@ -260,9 +260,3 @@ static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, *block_nr = blk; return BLOCK_CHANGED; } - - - - - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/bitops.c b/e2fsprogs/old_e2fsprogs/ext2fs/bitops.c index 987061130..3cf157949 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/bitops.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/bitops.c @@ -88,4 +88,3 @@ void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, bb_error_msg("#%lu", arg); #endif } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/block.c b/e2fsprogs/old_e2fsprogs/ext2fs/block.c index 498096995..dbd04f846 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/block.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/block.c @@ -435,4 +435,3 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs, return ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_NO_LARGE | flags, block_buf, xlate_func, &xl); } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c b/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c index b2d0279d8..796b0e4f5 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c @@ -259,6 +259,3 @@ done: } return retval; } - - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/bmove.c b/e2fsprogs/old_e2fsprogs/ext2fs/bmove.c index 635410da5..ec9244d0b 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/bmove.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/bmove.c @@ -153,4 +153,3 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, } return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/brel.h b/e2fsprogs/old_e2fsprogs/ext2fs/brel.h index 216fd132c..87bf72be4 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/brel.h +++ b/e2fsprogs/old_e2fsprogs/ext2fs/brel.h @@ -84,4 +84,3 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, #define ext2fs_brel_move(brel, old, new) ((brel)->move((brel), old, new)) #define ext2fs_brel_delete(brel, old) ((brel)->delete((brel), old)) #define ext2fs_brel_free(brel) ((brel)->free((brel))) - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c b/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c index 7ba7f22e2..bfa15e22a 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c @@ -378,4 +378,3 @@ errcode_t ext2fs_close(ext2_filsys fs) ext2fs_free(fs); return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c b/e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c index 05b8eb8d7..7f78ff804 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c @@ -70,4 +70,3 @@ errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c b/e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c index b7d873595..eb5dae0a6 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c @@ -217,4 +217,3 @@ next: return BLOCK_ABORT; return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c index f651338e3..f9c5a104b 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c @@ -130,4 +130,3 @@ errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block, { return ext2fs_write_dir_block2(fs, block, inbuf, 0); } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c b/e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c index 203c29fe3..d1879377a 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c @@ -92,6 +92,4 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) errout: ext2fs_free(fs); return retval; - } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/e2image.h b/e2fsprogs/old_e2fsprogs/ext2fs/e2image.h index 8d38ecc13..a598d0111 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/e2image.h +++ b/e2fsprogs/old_e2fsprogs/ext2fs/e2image.h @@ -37,16 +37,3 @@ struct ext2_image_hdr { __u32 offset_blockmap; /* Byte offset of the inode bitmaps */ __u32 offset_reserved[8]; }; - - - - - - - - - - - - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h b/e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h index cc91bb8d6..ca309c0d0 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h +++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h @@ -50,4 +50,3 @@ struct ext2_ext_attr_entry { sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND) #define EXT2_XATTR_SIZE(size) \ (((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND) - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h b/e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h index 908b5d9a4..7a02e9a8e 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h +++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h @@ -85,5 +85,3 @@ extern int ext2fs_process_dir_block(ext2_filsys fs, blk_t ref_block, int ref_offset, void *priv_data); - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/freefs.c b/e2fsprogs/old_e2fsprogs/ext2fs/freefs.c index 65c4ee794..0c5d48b11 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/freefs.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/freefs.c @@ -125,4 +125,3 @@ void ext2fs_free_dblist(ext2_dblist dblist) dblist->magic = 0; ext2fs_free_mem(&dblist); } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c index a98b2b9e5..a3bbad851 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c @@ -153,5 +153,4 @@ errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); ext2fs_free_mem(&buf); return retval; - } diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c b/e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c index c86a1c59a..a1038300b 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c @@ -67,5 +67,3 @@ errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf) #endif return io_channel_write_blk(fs->io, blk, 1, buf); } - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/inline.c b/e2fsprogs/old_e2fsprogs/ext2fs/inline.c index 9b620a772..d328cc950 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/inline.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/inline.c @@ -30,4 +30,3 @@ #include "ext2_fs.h" #define INCLUDE_INLINE_FUNCS #include "ext2fs.h" - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/inode.c b/e2fsprogs/old_e2fsprogs/ext2fs/inode.c index 5e0d081bd..7a1d5c94b 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/inode.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/inode.c @@ -764,4 +764,3 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino) return EXT2_ET_NO_DIRECTORY; return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c b/e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c index 4bfa93aef..b861d5ff6 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c @@ -268,4 +268,3 @@ static errcode_t inode_flush(io_channel channel) return ext2fs_file_flush(data->file); } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h b/e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h index 136635de0..17c586a29 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h +++ b/e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h @@ -60,6 +60,4 @@ typedef struct journal_superblock_s /* Dynamic information describing the current state of the log */ __u32 s_sequence; /* first commit ID expected in log */ __u32 s_start; /* blocknr of start of log */ - } journal_superblock_t; - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/lookup.c b/e2fsprogs/old_e2fsprogs/ext2fs/lookup.c index 31b30a182..b2e8de8ec 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/lookup.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/lookup.c @@ -66,5 +66,3 @@ errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name, return (ls.found) ? 0 : EXT2_ET_FILE_NOT_FOUND; } - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c index 93f47b06f..a86ac8e93 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c @@ -136,7 +136,4 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, cleanup: ext2fs_free_mem(&block); return retval; - } - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c index db1c8bff3..748d9abc7 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c @@ -188,7 +188,6 @@ static int mkjournal_proc(ext2_filsys fs, return (BLOCK_CHANGED | BLOCK_ABORT); else return BLOCK_CHANGED; - } /* @@ -423,6 +422,5 @@ main(int argc, char **argv) } ext2fs_close(fs); exit(0); - } #endif diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/namei.c b/e2fsprogs/old_e2fsprogs/ext2fs/namei.c index 14d48fb72..18244613c 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/namei.c @@ -202,4 +202,3 @@ errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, ext2fs_free_mem(&buf); return retval; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/newdir.c b/e2fsprogs/old_e2fsprogs/ext2fs/newdir.c index 9470e7f56..9f156626d 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/newdir.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/newdir.c @@ -66,7 +66,6 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, dir->name_len = 2 | filetype; dir->name[0] = '.'; dir->name[1] = '.'; - } *block = buf; return 0; diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c b/e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c index 4766157c2..ce77bc9f6 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c @@ -94,5 +94,3 @@ errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list) return rb.err; } - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c b/e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c index 831adcc3a..bf1fc328b 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c @@ -94,5 +94,3 @@ errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, return ext2fs_read_bb_FILE2(fs, f, bb_list, (void *) invalid, call_compat_invalid); } - - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c b/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c index 3c550d511..403463a90 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c @@ -218,4 +218,3 @@ out_free: ext2fs_free_mem((void *)&dindir_buf); return retval; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c b/e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c index e932b3c9d..32e87b77a 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c @@ -104,4 +104,3 @@ errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, bmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; return retval; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c index 0ae0a8234..b618acc5b 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c @@ -293,4 +293,3 @@ errcode_t ext2fs_write_bitmaps(ext2_filsys fs) } return 0; } - diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c b/e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c index 2fca3cfbb..07b757abd 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c @@ -66,7 +66,6 @@ void ext2fs_swap_super(struct ext2_super_block * sb) sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]); for (i=0; i < 17; i++) sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]); - } void ext2fs_swap_group_desc(struct ext2_group_desc *gdp) @@ -222,7 +221,6 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t, ext2fs_swap_ext_attr((char *) (eat + 1), (char *) (eaf + 1), bufsize - sizeof(struct ext2_inode) - t->i_extra_isize - sizeof(__u32), 0); - } void ext2fs_swap_inode(ext2_filsys fs, struct ext2_inode *t, diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/unlink.c b/e2fsprogs/old_e2fsprogs/ext2fs/unlink.c index 83ac2713e..71a9ffcb9 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/unlink.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/unlink.c @@ -97,4 +97,3 @@ errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, return (ls.done) ? 0 : EXT2_ET_DIR_NO_SPACE; } - diff --git a/e2fsprogs/old_e2fsprogs/util.c b/e2fsprogs/old_e2fsprogs/util.c index 64cca05a7..0829f5686 100644 --- a/e2fsprogs/old_e2fsprogs/util.c +++ b/e2fsprogs/old_e2fsprogs/util.c @@ -95,7 +95,6 @@ force_check: bb_error_msg("%s is apparently in use by the system", device); goto force_check; } - } void parse_journal_opts(char **journal_device, int *journal_flags, diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 215e4a9e0..78ca22585 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c @@ -168,7 +168,6 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv) { die_if_bad_username(argv[0]); new_group(argv[0], gid); - } /* Reached only on success */ return EXIT_SUCCESS; diff --git a/miscutils/crond.c b/miscutils/crond.c index 66110bb85..d028eb089 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -243,7 +243,6 @@ static void ParseField(char *user, char *ary, int modvalue, int off, goto err; } } while (n1 != n2); - } if (*ptr != ',') { break; diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 9738620fd..236b1749c 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -730,8 +730,8 @@ static void identify(uint16_t *val) if (val[MINOR] && (val[MINOR] <= MINOR_MAX)) { if (like_std < 3) like_std = 3; std = actual_ver[val[MINOR]]; - if (std) printf("\n\tUsed: %s ", nth_string(minor_str, val[MINOR])); - + if (std) + printf("\n\tUsed: %s ", nth_string(minor_str, val[MINOR])); } /* looks like when they up-issue the std, they obsolete one; * thus, only the newest 4 issues need be supported. (That's diff --git a/networking/ntpd.c b/networking/ntpd.c index 14c3a5fbb..d00ee49e5 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -592,7 +592,6 @@ filter_datapoints(peer_t *p) p->filter_offset, x, p->filter_dispersion, p->filter_jitter); - } static void diff --git a/networking/telnet.c b/networking/telnet.c index 57997f6b9..e0022b2cb 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -150,7 +150,6 @@ static void con_escape(void) cookmode(); ret: bb_got_signal = 0; - } static void handle_net_output(int len) diff --git a/networking/traceroute.c b/networking/traceroute.c index 2d3e77011..c18fba8d0 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -666,7 +666,6 @@ packet_ok(int read_len, len_and_sockaddr *from_lsa, return (type == ICMP6_TIME_EXCEEDED ? -1 : (code<<8)+1); } } - } # if ENABLE_FEATURE_TRACEROUTE_VERBOSE diff --git a/selinux/setfiles.c b/selinux/setfiles.c index f45e41b2b..989510e3d 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c @@ -118,7 +118,6 @@ static void add_exclude(const char *directory) if (directory == NULL || directory[0] != '/') { bb_error_msg_and_die("full path required for exclude: %s", directory); - } if (lstat(directory, &sb)) { bb_error_msg("directory \"%s\" not found, ignoring", directory); diff --git a/shell/ash.c b/shell/ash.c index 988edab8a..d8becc37a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -11215,7 +11215,6 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) } IF_ASH_ALIAS(if (c != PEOA)) USTPUTC(c, out); - } c = pgetc_fast(); } /* for (;;) */ @@ -12055,7 +12054,6 @@ evalcmd(int argc UNUSED_PARAM, char **argv) p = grabstackstr(concat); } evalstring(p, ~SKIPEVAL); - } return exitstatus; } diff --git a/shell/hush.c b/shell/hush.c index 45c98bb36..0a420f685 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4518,7 +4518,6 @@ static NOINLINE int run_pipe(struct pipe *pi) #ifdef CMD_SINGLEWORD_NOGLOB_COND else if (command->cmd_type == CMD_SINGLEWORD_NOGLOB_COND) { argv_expanded = expand_strvec_to_strvec_singleword_noglob_cond(argv + command->assignment_cnt); - } #endif else { diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index aa718c787..fc02000e5 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -2043,7 +2043,6 @@ fix_partition_table_order(void) fix_chain_of_logicals(); printf("Done.\n"); - } #endif diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c index c8cf946df..f41d4e0d9 100644 --- a/util-linux/volume_id/volume_id.c +++ b/util-linux/volume_id/volume_id.c @@ -195,7 +195,6 @@ int FAST_FUNC volume_id_probe_all(struct volume_id *id, /*uint64_t off,*/ uint64 ret: volume_id_free_buffer(id); return (- id->error); /* 0 or -1 */ - } /* open volume by device node */ -- cgit v1.2.3-55-g6feb From ba2dcccd799963ac74ee92300df494947820608b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 26 Jul 2010 01:49:12 +0200 Subject: *: trailing empty lines removed Signed-off-by: Denys Vlasenko --- archival/libunarchive/unxz/README | 1 - debianutils/Config.src | 1 - docs/busybox_footer.pod | 1 - docs/cgi/cl.html | 2 +- docs/cgi/env.html | 2 +- docs/cgi/in.html | 2 +- docs/cgi/interface.html | 2 +- docs/cgi/out.html | 2 +- docs/contributing.txt | 2 -- docs/posix_conformance.txt | 1 - e2fsprogs/old_e2fsprogs/e2fsck.h | 2 -- e2fsprogs/old_e2fsprogs/e2p/ostype.c | 2 -- examples/bootfloppy/display.txt | 1 - examples/bootfloppy/etc/fstab | 1 - examples/bootfloppy/etc/inittab | 1 - examples/bootfloppy/etc/profile | 1 - examples/bootfloppy/mkrootfs.sh | 1 - examples/inittab | 1 - init/reboot.h | 1 - libbb/README | 1 - libbb/selinux_common.c | 1 - networking/libiproute/ll_proto.c | 1 - scripts/Makefile.host | 1 - scripts/Makefile.lib | 2 -- scripts/basic/docproc.c | 1 - scripts/find_stray_empty_lines | 10 ++++++++++ scripts/kconfig/check.sh | 1 - scripts/kconfig/lex.zconf.c_shipped | 1 - scripts/kconfig/menu.c | 1 - scripts/kconfig/util.c | 1 - scripts/kconfig/zconf.hash.c_shipped | 1 - scripts/kconfig/zconf.tab.c_shipped | 2 -- scripts/showasm | 1 - selinux/Config.src | 1 - shell/hush_test/hush-misc/break1.tests | 1 - sysklogd/Config.src | 1 - testsuite/basename/basename-works | 1 - testsuite/dirname/dirname-works | 1 - testsuite/expr/expr-works | 1 - testsuite/ln/ln-preserves-soft-links | 1 - testsuite/readlink.tests | 1 - testsuite/uptime/uptime-works | 1 - 42 files changed, 15 insertions(+), 46 deletions(-) (limited to 'shell') diff --git a/archival/libunarchive/unxz/README b/archival/libunarchive/unxz/README index f79b0a404..c5972f6b8 100644 --- a/archival/libunarchive/unxz/README +++ b/archival/libunarchive/unxz/README @@ -133,4 +133,3 @@ Specifying the calling convention For example, on Windows, you may make all functions use the stdcall calling convention by defining XZ_FUNC=__stdcall when building and using the functions from XZ Embedded. - diff --git a/debianutils/Config.src b/debianutils/Config.src index 838d8f00c..cbc09b5ce 100644 --- a/debianutils/Config.src +++ b/debianutils/Config.src @@ -83,4 +83,3 @@ config WHICH print out their pathnames. endmenu - diff --git a/docs/busybox_footer.pod b/docs/busybox_footer.pod index 5ed937991..47eabaeeb 100644 --- a/docs/busybox_footer.pod +++ b/docs/busybox_footer.pod @@ -253,4 +253,3 @@ Tito Ragusa devfsd and size optimizations in strings, openvt and deallocvt. =cut - diff --git a/docs/cgi/cl.html b/docs/cgi/cl.html index 5779d623e..4f8faae9f 100644 --- a/docs/cgi/cl.html +++ b/docs/cgi/cl.html @@ -43,4 +43,4 @@ CGI - Common Gateway Interface

cgi@ncsa.uiuc.edu
- \ No newline at end of file + diff --git a/docs/cgi/env.html b/docs/cgi/env.html index 924026b3e..b83c750bf 100644 --- a/docs/cgi/env.html +++ b/docs/cgi/env.html @@ -146,4 +146,4 @@ interface specification

CGI - Common Gateway Interface

cgi@ncsa.uiuc.edu
- \ No newline at end of file + diff --git a/docs/cgi/in.html b/docs/cgi/in.html index 679306aaa..7ee5fe601 100644 --- a/docs/cgi/in.html +++ b/docs/cgi/in.html @@ -30,4 +30,4 @@ interface specification

CGI - Common Gateway Interface

cgi@ncsa.uiuc.edu
- \ No newline at end of file + diff --git a/docs/cgi/interface.html b/docs/cgi/interface.html index ea73ce3a2..0be016b4c 100644 --- a/docs/cgi/interface.html +++ b/docs/cgi/interface.html @@ -26,4 +26,4 @@ the following is a hotlink to graphic detail.

CGI - Common Gateway Interface

cgi@ncsa.uiuc.edu
- \ No newline at end of file + diff --git a/docs/cgi/out.html b/docs/cgi/out.html index 2203ee5a0..5266985b5 100644 --- a/docs/cgi/out.html +++ b/docs/cgi/out.html @@ -123,4 +123,4 @@ interface specification

CGI - Common Gateway Interface

cgi@ncsa.uiuc.edu
- \ No newline at end of file + diff --git a/docs/contributing.txt b/docs/contributing.txt index d06e4a2da..39aaef1b5 100644 --- a/docs/contributing.txt +++ b/docs/contributing.txt @@ -426,5 +426,3 @@ you're having difficulty following some of the steps outlined in this document don't worry, the folks on the Busybox mailing list are a fairly good-natured bunch and will work with you to help get your patches into shape or help you make contributions. - - diff --git a/docs/posix_conformance.txt b/docs/posix_conformance.txt index d9fa116b8..5b616d701 100644 --- a/docs/posix_conformance.txt +++ b/docs/posix_conformance.txt @@ -739,4 +739,3 @@ xargs Busybox specific options: zcat POSIX options: None zcat Busybox specific options: None - diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.h b/e2fsprogs/old_e2fsprogs/e2fsck.h index 73d398ff4..fdfa2d84a 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.h +++ b/e2fsprogs/old_e2fsprogs/e2fsck.h @@ -636,5 +636,3 @@ static inline int tid_geq(tid_t x, tid_t y) int difference = (x - y); return (difference >= 0); } - - diff --git a/e2fsprogs/old_e2fsprogs/e2p/ostype.c b/e2fsprogs/old_e2fsprogs/e2p/ostype.c index 1abe2ba91..6a2f178f3 100644 --- a/e2fsprogs/old_e2fsprogs/e2p/ostype.c +++ b/e2fsprogs/old_e2fsprogs/e2p/ostype.c @@ -70,5 +70,3 @@ int main(int argc, char **argv) exit(0); } #endif - - diff --git a/examples/bootfloppy/display.txt b/examples/bootfloppy/display.txt index 399d326d9..7cae48bb3 100644 --- a/examples/bootfloppy/display.txt +++ b/examples/bootfloppy/display.txt @@ -1,4 +1,3 @@ This boot floppy is made with Busybox, uClibc, and the Linux kernel. Hit RETURN to boot or enter boot parameters at the prompt below. - diff --git a/examples/bootfloppy/etc/fstab b/examples/bootfloppy/etc/fstab index ef14ca2cc..b31f60217 100644 --- a/examples/bootfloppy/etc/fstab +++ b/examples/bootfloppy/etc/fstab @@ -1,2 +1 @@ proc /proc proc defaults 0 0 - diff --git a/examples/bootfloppy/etc/inittab b/examples/bootfloppy/etc/inittab index eb3e979ce..1ac9f68ce 100644 --- a/examples/bootfloppy/etc/inittab +++ b/examples/bootfloppy/etc/inittab @@ -2,4 +2,3 @@ ::respawn:-/bin/sh tty2::askfirst:-/bin/sh ::ctrlaltdel:/bin/umount -a -r - diff --git a/examples/bootfloppy/etc/profile b/examples/bootfloppy/etc/profile index 8a7c77d78..cf68d3393 100644 --- a/examples/bootfloppy/etc/profile +++ b/examples/bootfloppy/etc/profile @@ -5,4 +5,3 @@ echo -n "Processing /etc/profile... " # no-op echo "Done" echo - diff --git a/examples/bootfloppy/mkrootfs.sh b/examples/bootfloppy/mkrootfs.sh index 5cdff21a0..a7fc48b13 100755 --- a/examples/bootfloppy/mkrootfs.sh +++ b/examples/bootfloppy/mkrootfs.sh @@ -102,4 +102,3 @@ then rmdir $TARGET_DIR gzip -9 rootfs fi - diff --git a/examples/inittab b/examples/inittab index 64fc4fce1..c4e0af514 100644 --- a/examples/inittab +++ b/examples/inittab @@ -87,4 +87,3 @@ tty5::respawn:/sbin/getty 38400 tty6 ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r ::shutdown:/sbin/swapoff -a - diff --git a/init/reboot.h b/init/reboot.h index ff045fdd1..949763949 100644 --- a/init/reboot.h +++ b/init/reboot.h @@ -28,4 +28,3 @@ # define RB_POWER_OFF RB_HALT_SYSTEM # endif #endif - diff --git a/libbb/README b/libbb/README index 4f28f7e34..6e63dc5f2 100644 --- a/libbb/README +++ b/libbb/README @@ -8,4 +8,3 @@ that you wrote that is mis-attributed, do let me know so we can fix that up. Erik Andersen - diff --git a/libbb/selinux_common.c b/libbb/selinux_common.c index 7b5696754..2acb50e96 100644 --- a/libbb/selinux_common.c +++ b/libbb/selinux_common.c @@ -53,4 +53,3 @@ void FAST_FUNC selinux_preserve_fcontext(int fdesc) setfscreatecon_or_die(context); freecon(context); } - diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c index 145902b2e..1cd576f1d 100644 --- a/networking/libiproute/ll_proto.c +++ b/networking/libiproute/ll_proto.c @@ -126,4 +126,3 @@ int FAST_FUNC ll_proto_a2n(unsigned short *id, char *buf) *id = htons(i); return 0; } - diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 23bd9ff10..2e628508d 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -153,4 +153,3 @@ $(host-cshlib): %: $(host-cshobjs) FORCE targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) - diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index be679b624..3e54ea712 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -168,5 +168,3 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ quiet_cmd_gzip = GZIP $@ cmd_gzip = gzip -f -9 < $< > $@ - - diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 50ef37157..db30019d8 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c @@ -397,4 +397,3 @@ int main(int argc, char **argv) fflush(stdout); return exitstatus; } - diff --git a/scripts/find_stray_empty_lines b/scripts/find_stray_empty_lines index 58daf2f0c..60873dac1 100755 --- a/scripts/find_stray_empty_lines +++ b/scripts/find_stray_empty_lines @@ -5,3 +5,13 @@ grep -n -A1 -r $'^\t*{$' . | grep -B1 '.[ch]-[0-9]*-$' # or (less surefire ones): grep -n -B1 -r $'^\t*}' . | grep -A1 '.[ch]-[0-9]*-$' grep -n -A1 -r $'^\t*{' . | grep -B1 '.[ch]-[0-9]*-$' + +# find trailing empty lines +find -type f | xargs tail -1 | while read file; do + test x"$file" = x"" && continue + read lastline + #echo "|$file|$lastline" + if test x"$lastline" = x""; then + echo "$file" + fi +done diff --git a/scripts/kconfig/check.sh b/scripts/kconfig/check.sh index fa59cbf9d..15fc29421 100755 --- a/scripts/kconfig/check.sh +++ b/scripts/kconfig/check.sh @@ -11,4 +11,3 @@ EOF if [ ! "$?" -eq "0" ]; then echo -DKBUILD_NO_NLS; fi - diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index 5fc323de3..4837bbf64 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped @@ -2322,4 +2322,3 @@ char *zconf_curname(void) { return current_pos.file ? current_pos.file->name : ""; } - diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 0fce20cb7..14cf2ead0 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -394,4 +394,3 @@ struct menu *menu_get_parent_menu(struct menu *menu) } return menu; } - diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index ef4c83228..263091945 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -112,4 +112,3 @@ const char *str_get(struct gstr *gs) { return gs->s; } - diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 345f0fc07..d39cf189a 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped @@ -228,4 +228,3 @@ kconf_id_lookup (register const char *str, register unsigned int len) } return 0; } - diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index b62724da0..a27d256d6 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -2169,5 +2169,3 @@ void zconfdump(FILE *out) #include "expr.c" #include "symbol.c" #include "menu.c" - - diff --git a/scripts/showasm b/scripts/showasm index 046442653..dc2cd705d 100755 --- a/scripts/showasm +++ b/scripts/showasm @@ -18,4 +18,3 @@ then fi objdump -d $1 | sed -n -e '/./{H;$!d}' -e "x;/^.[0-9a-fA-F]* <$2>:/p" - diff --git a/selinux/Config.src b/selinux/Config.src index 64a99203e..47d15b6af 100644 --- a/selinux/Config.src +++ b/selinux/Config.src @@ -122,4 +122,3 @@ config SESTATUS Displays the status of SELinux. endmenu - diff --git a/shell/hush_test/hush-misc/break1.tests b/shell/hush_test/hush-misc/break1.tests index 912f149c1..3a6b060d9 100755 --- a/shell/hush_test/hush-misc/break1.tests +++ b/shell/hush_test/hush-misc/break1.tests @@ -1,3 +1,2 @@ while true; do echo A; break; echo B; done echo OK:$? - diff --git a/sysklogd/Config.src b/sysklogd/Config.src index bfe2d1cc3..41c0d286b 100644 --- a/sysklogd/Config.src +++ b/sysklogd/Config.src @@ -128,4 +128,3 @@ config LOGGER problems that occur within programs and scripts. endmenu - diff --git a/testsuite/basename/basename-works b/testsuite/basename/basename-works index 38907d4c1..7140e9988 100644 --- a/testsuite/basename/basename-works +++ b/testsuite/basename/basename-works @@ -1,2 +1 @@ test x$(basename $(pwd)) = x$(busybox basename $(pwd)) - diff --git a/testsuite/dirname/dirname-works b/testsuite/dirname/dirname-works index f339c8f73..d673dd937 100644 --- a/testsuite/dirname/dirname-works +++ b/testsuite/dirname/dirname-works @@ -1,2 +1 @@ test x$(dirname $(pwd)) = x$(busybox dirname $(pwd)) - diff --git a/testsuite/expr/expr-works b/testsuite/expr/expr-works index af49ac4d5..5a0fffbdc 100644 --- a/testsuite/expr/expr-works +++ b/testsuite/expr/expr-works @@ -56,4 +56,3 @@ busybox expr 0 \>= 1 if [ $? != 1 ] ; then exit 1; fi; - diff --git a/testsuite/ln/ln-preserves-soft-links b/testsuite/ln/ln-preserves-soft-links index a8123ece3..3a49bedf4 100644 --- a/testsuite/ln/ln-preserves-soft-links +++ b/testsuite/ln/ln-preserves-soft-links @@ -6,4 +6,3 @@ if [ $? != 0 ] ; then exit 0; fi exit 1; - diff --git a/testsuite/readlink.tests b/testsuite/readlink.tests index e6822dff1..ecc3ad03e 100755 --- a/testsuite/readlink.tests +++ b/testsuite/readlink.tests @@ -29,4 +29,3 @@ testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$ # clean up rm -r "$TESTLINK" "$TESTDIR" - diff --git a/testsuite/uptime/uptime-works b/testsuite/uptime/uptime-works index 80e578778..6b168ab0e 100644 --- a/testsuite/uptime/uptime-works +++ b/testsuite/uptime/uptime-works @@ -1,2 +1 @@ busybox uptime - -- cgit v1.2.3-55-g6feb From 17e0e43c3522882e2ac8e921132540ba01a1c66c Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Tue, 27 Jul 2010 08:40:55 +0200 Subject: ulimit: set both hard and soft limits by default function old new delta shell_builtin_ulimit 494 498 +4 Signed-off-by: Alexander Shishkin Signed-off-by: Denys Vlasenko --- shell/shell_common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'shell') diff --git a/shell/shell_common.c b/shell/shell_common.c index 3114ff3f7..dc363e298 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c @@ -428,9 +428,14 @@ shell_builtin_ulimit(char **argv) val <<= l->factor_shift; } //bb_error_msg("opt %c val_str:'%s' val:%lld", opt_char, val_str, (long long)val); + /* from man bash: "If neither -H nor -S + * is specified, both the soft and hard + * limits are set. */ + if (!opts) + opts = OPT_hard + OPT_soft; if (opts & OPT_hard) limit.rlim_max = val; - if ((opts & OPT_soft) || opts == 0) + if (opts & OPT_soft) limit.rlim_cur = val; //bb_error_msg("setrlimit(%d, %lld, %lld)", l->cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max); if (setrlimit(l->cmd, &limit) < 0) { -- cgit v1.2.3-55-g6feb From 430ba79c39eeed4725c36e9c2ad61c438c8a5d3e Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Fri, 30 Jul 2010 06:21:21 +0200 Subject: cttyhack: serial console detection is Linux-specific Signed-off-by: Jeremie Koenig Signed-off-by: Denys Vlasenko --- shell/cttyhack.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'shell') diff --git a/shell/cttyhack.c b/shell/cttyhack.c index a80d49dc3..3a78bae29 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c @@ -13,7 +13,6 @@ //config:config CTTYHACK //config: bool "cttyhack" //config: default y -//config: depends on PLATFORM_LINUX //config: help //config: One common problem reported on the mailing list is "can't access tty; //config: job control turned off" error message which typically appears when @@ -59,6 +58,10 @@ //usage: "\nStarting interactive shell from boot shell script:" //usage: "\n setsid cttyhack sh" +#if !defined(__linux__) && !defined(TIOCGSERIAL) +# warning cttyhack will not be able to detect a controlling tty on this system +#endif + /* From */ struct vt_stat { unsigned short v_active; /* active vt */ @@ -112,13 +115,19 @@ int cttyhack_main(int argc UNUSED_PARAM, char **argv) close(fd); } else { /* We don't have ctty (or don't have "/dev/tty" node...) */ - if (ioctl(0, TIOCGSERIAL, &u.sr) == 0) { + if (0) {} +#ifdef TIOCGSERIAL + else if (ioctl(0, TIOCGSERIAL, &u.sr) == 0) { /* this is a serial console */ sprintf(console + 8, "S%d", u.sr.line); - } else if (ioctl(0, VT_GETSTATE, &u.vt) == 0) { + } +#endif +#ifdef __linux__ + else if (ioctl(0, VT_GETSTATE, &u.vt) == 0) { /* this is linux virtual tty */ sprintf(console + 8, "S%d" + 1, u.vt.v_active); } +#endif if (console[8]) { fd = xopen(console, O_RDWR); //bb_error_msg("switching to '%s'", console); -- cgit v1.2.3-55-g6feb From 17662801ece60bbcc45bbc3cb1fc0fc3070d0d23 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 30 Jul 2010 17:41:35 +0200 Subject: cttyhack: make it survive WERROR build Signed-off-by: Denys Vlasenko --- shell/cttyhack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell') diff --git a/shell/cttyhack.c b/shell/cttyhack.c index 3a78bae29..7a5e1ffd2 100644 --- a/shell/cttyhack.c +++ b/shell/cttyhack.c @@ -58,7 +58,7 @@ //usage: "\nStarting interactive shell from boot shell script:" //usage: "\n setsid cttyhack sh" -#if !defined(__linux__) && !defined(TIOCGSERIAL) +#if !defined(__linux__) && !defined(TIOCGSERIAL) && !ENABLE_WERROR # warning cttyhack will not be able to detect a controlling tty on this system #endif -- cgit v1.2.3-55-g6feb From b0fbe4b5409b136e0c80788cf183ec24237e9c97 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 5 Aug 2010 17:19:27 +0200 Subject: ash: add a testcase for bug 2281 (currently fails). Small code cleanups. function old new delta changepath 195 192 -3 subevalvar 1204 1200 -4 readtoken1 3247 3240 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-14) Total: -14 bytes Signed-off-by: Denys Vlasenko --- shell/ash.c | 83 +++++++++++++++++++++------------ shell/ash_test/ash-redir/redir9.tests | 0 shell/ash_test/ash-vars/var_bash3.right | 40 ++++++++-------- shell/ash_test/ash-vars/var_bash3.tests | 47 +++++++++++-------- shell/ash_test/ash-vars/var_bash4.right | 2 + shell/ash_test/ash-vars/var_bash4.tests | 3 ++ 6 files changed, 104 insertions(+), 71 deletions(-) mode change 100644 => 100755 shell/ash_test/ash-redir/redir9.tests create mode 100644 shell/ash_test/ash-vars/var_bash4.right create mode 100755 shell/ash_test/ash-vars/var_bash4.tests (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index d8becc37a..16783f2e8 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -6296,13 +6296,14 @@ parse_sub_pattern(char *arg, int inquotes) #endif /* ENABLE_ASH_BASH_COMPAT */ static const char * -subevalvar(char *p, char *str, int strloc, int subtype, +subevalvar(char *p, char *varname, int strloc, int subtype, int startloc, int varflags, int quotes, struct strlist *var_str_list) { struct nodelist *saveargbackq = argbackq; char *startp; char *loc; char *rmesc, *rmescend; + char *str; IF_ASH_BASH_COMPAT(const char *repl = NULL;) IF_ASH_BASH_COMPAT(int pos, len, orig_len;) int saveherefd = herefd; @@ -6310,6 +6311,9 @@ subevalvar(char *p, char *str, int strloc, int subtype, int zero; char *(*scan)(char*, char*, char*, char*, int, int); + //bb_error_msg("subevalvar(p:'%s',varname:'%s',strloc:%d,subtype:%d,startloc:%d,varflags:%x,quotes:%d", + // p, varname, strloc, subtype, startloc, varflags, quotes); + herefd = -1; argstr(p, (subtype != VSASSIGN && subtype != VSQUESTION) ? EXP_CASE : 0, var_str_list); @@ -6320,11 +6324,15 @@ subevalvar(char *p, char *str, int strloc, int subtype, switch (subtype) { case VSASSIGN: - setvar(str, startp, 0); + setvar(varname, startp, 0); amount = startp - expdest; STADJUST(amount, expdest); return startp; + case VSQUESTION: + varunset(p, varname, startp, varflags); + /* NOTREACHED */ + #if ENABLE_ASH_BASH_COMPAT case VSSUBSTR: loc = str = stackblock() + strloc; @@ -6385,11 +6393,8 @@ subevalvar(char *p, char *str, int strloc, int subtype, STADJUST(amount, expdest); return loc; #endif - - case VSQUESTION: - varunset(p, str, startp, varflags); - /* NOTREACHED */ } + resetloc = expdest - (char *)stackblock(); /* We'll comeback here if we grow the stack while handling @@ -6423,13 +6428,14 @@ subevalvar(char *p, char *str, int strloc, int subtype, if (!repl) { repl = parse_sub_pattern(str, varflags & VSQUOTE); + //bb_error_msg("repl:'%s'", repl); if (!repl) repl = nullstr; } /* If there's no pattern to match, return the expansion unmolested */ if (str[0] == '\0') - return 0; + return NULL; len = 0; idx = startp; @@ -6437,6 +6443,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, while (idx < end) { try_to_match: loc = scanright(idx, rmesc, rmescend, str, quotes, 1); + //bb_error_msg("scanright('%s'):'%s'", str, loc); if (!loc) { /* No match, advance */ char *restart_detect = stackblock(); @@ -6475,6 +6482,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, idx = loc; } + //bb_error_msg("repl:'%s'", repl); for (loc = (char*)repl; *loc; loc++) { char *restart_detect = stackblock(); if (quotes && *loc == '\\') { @@ -6510,6 +6518,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, STPUTC('\0', expdest); startp = (char *)stackblock() + startloc; memmove(startp, (char *)stackblock() + workloc, len + 1); + //bb_error_msg("startp:'%s'", startp); amount = expdest - (startp + len); STADJUST(-amount, expdest); return startp; @@ -6810,7 +6819,7 @@ evalvar(char *p, int flags, struct strlist *var_str_list) */ STPUTC('\0', expdest); patloc = expdest - (char *)stackblock(); - if (NULL == subevalvar(p, /* str: */ NULL, patloc, subtype, + if (NULL == subevalvar(p, /* varname: */ NULL, patloc, subtype, startloc, varflags, //TODO: | EXP_REDIR too? All other such places do it too /* quotes: */ flags & (EXP_FULL | EXP_CASE), @@ -11114,8 +11123,11 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) USTPUTC('\\', out); } #endif - if (dblquote && c != '\\' - && c != '`' && c != '$' + /* Backslash is retained if we are in "str" and next char isn't special */ + if (dblquote + && c != '\\' + && c != '`' + && c != '$' && (c != '"' || eofmark != NULL) ) { USTPUTC(CTLESC, out); @@ -11187,7 +11199,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) } else { /* * unbalanced parens - * (don't 2nd guess - no error) + * (don't 2nd guess - no error) */ pungetc(); USTPUTC(')', out); @@ -11380,8 +11392,6 @@ parsesub: { unsigned char subtype; int typeloc; int flags; - char *p; - static const char types[] ALIGN1 = "}-+?="; c = pgetc(); if (c > 255 /* PEOA or PEOF */ @@ -11394,7 +11404,8 @@ parsesub: { #endif USTPUTC('$', out); pungetc(); - } else if (c == '(') { /* $(command) or $((arith)) */ + } else if (c == '(') { + /* $(command) or $((arith)) */ if (pgetc() == '(') { #if ENABLE_SH_MATH_SUPPORT PARSEARITH(); @@ -11406,6 +11417,7 @@ parsesub: { PARSEBACKQNEW(); } } else { + /* $VAR, $, ${...}, or PEOA/PEOF */ USTPUTC(CTLVAR, out); typeloc = out - (char *)stackblock(); USTPUTC(VSNORMAL, out); @@ -11415,76 +11427,85 @@ parsesub: { if (c == '#') { c = pgetc(); if (c == '}') - c = '#'; + c = '#'; /* ${#} - same as $# */ else - subtype = VSLENGTH; - } else + subtype = VSLENGTH; /* ${#VAR} */ + } else { subtype = 0; + } } if (c <= 255 /* not PEOA or PEOF */ && is_name(c)) { + /* $[{[#]]NAME[}] */ do { STPUTC(c, out); c = pgetc(); } while (c <= 255 /* not PEOA or PEOF */ && is_in_name(c)); } else if (isdigit(c)) { + /* $[{[#]]NUM[}] */ do { STPUTC(c, out); c = pgetc(); } while (isdigit(c)); } else if (is_special(c)) { + /* $[{[#]][}] */ USTPUTC(c, out); c = pgetc(); } else { badsub: raise_error_syntax("bad substitution"); } - if (c != '}' && subtype == VSLENGTH) + if (c != '}' && subtype == VSLENGTH) { + /* ${#VAR didn't end with } */ goto badsub; + } STPUTC('=', out); flags = 0; if (subtype == 0) { + /* ${VAR...} but not $VAR or ${#VAR} */ + /* c == first char after VAR */ switch (c) { case ':': c = pgetc(); #if ENABLE_ASH_BASH_COMPAT if (c == ':' || c == '$' || isdigit(c)) { - pungetc(); subtype = VSSUBSTR; - break; + pungetc(); + break; /* "goto do_pungetc" is bigger (!) */ } #endif flags = VSNUL; /*FALLTHROUGH*/ - default: - p = strchr(types, c); + default: { + static const char types[] ALIGN1 = "}-+?="; + const char *p = strchr(types, c); if (p == NULL) goto badsub; subtype = p - types + VSNORMAL; break; + } case '%': case '#': { int cc = c; - subtype = c == '#' ? VSTRIMLEFT : VSTRIMRIGHT; + subtype = (c == '#' ? VSTRIMLEFT : VSTRIMRIGHT); c = pgetc(); - if (c == cc) - subtype++; - else - pungetc(); + if (c != cc) + goto do_pungetc; + subtype++; break; } #if ENABLE_ASH_BASH_COMPAT case '/': subtype = VSREPLACE; c = pgetc(); - if (c == '/') - subtype++; /* VSREPLACEALL */ - else - pungetc(); + if (c != '/') + goto do_pungetc; + subtype++; /* VSREPLACEALL */ break; #endif } } else { + do_pungetc: pungetc(); } if (dblquote || arinest) diff --git a/shell/ash_test/ash-redir/redir9.tests b/shell/ash_test/ash-redir/redir9.tests old mode 100644 new mode 100755 diff --git a/shell/ash_test/ash-vars/var_bash3.right b/shell/ash_test/ash-vars/var_bash3.right index f7f14791e..a97c850ea 100644 --- a/shell/ash_test/ash-vars/var_bash3.right +++ b/shell/ash_test/ash-vars/var_bash3.right @@ -1,20 +1,20 @@ -a041#c -a041#c -a\041#c -a\041#c -a\041#c -a\041#c -a\041#c -a\041#c -a\041#c -a\c -a\c -a\c -a\\c -a\\c -a\\c -a\tc -a\tc -a\tc -atc -a\tc +1 a041#c +2 a041#c +3 a\041#c +4 a\041#c +5 a\041#c +6 a\041#c +7 a\041#c +8 a\041#c +9 a\041#c +10 a\c +11 a\c +12 a\c +13 a\\c +14 a\\c +15 a\\c +16 a\tc +17 a\tc +18 a\tc +19 atc +20 a\tc diff --git a/shell/ash_test/ash-vars/var_bash3.tests b/shell/ash_test/ash-vars/var_bash3.tests index b9050279e..eca3318e2 100755 --- a/shell/ash_test/ash-vars/var_bash3.tests +++ b/shell/ash_test/ash-vars/var_bash3.tests @@ -1,41 +1,48 @@ a='abc' r=${a//b/\041#} -echo $r -echo ${a//b/\041#} -echo "${a//b/\041#}" +echo 1 $r +echo 2 ${a//b/\041#} +echo 3 "${a//b/\041#}" +# --- var_bash3.xx +# +++ var_bash3.right +# -1 a\041#c +# +1 a041#c +# 2 a041#c +# -3 a041#c +# +3 a\041#c a='abc' r=${a//b/\\041#} -echo $r -echo ${a//b/\\041#} -echo "${a//b/\\041#}" +echo 4 $r +echo 5 ${a//b/\\041#} +echo 6 "${a//b/\\041#}" a='abc' b='\041#' r=${a//b/$b} -echo $r -echo ${a//b/$b} -echo "${a//b/$b}" +echo 7 $r +echo 8 ${a//b/$b} +echo 9 "${a//b/$b}" a='abc' b='\' r="${a//b/$b}" -echo $r -echo ${a//b/$b} -echo "${a//b/$b}" +echo 10 $r +echo 11 ${a//b/$b} +echo 12 "${a//b/$b}" a='abc' b='\\' r="${a//b/$b}" -echo $r -echo ${a//b/$b} -echo "${a//b/$b}" +echo 13 $r +echo 14 ${a//b/$b} +echo 15 "${a//b/$b}" a='abc' b='\t' r="${a//b/$b}" -echo $r -echo ${a//b/$b} -echo "${a//b/$b}" -echo ${a//b/\t} -echo "${a//b/\t}" +echo 16 $r +echo 17 ${a//b/$b} +echo 18 "${a//b/$b}" +echo 19 ${a//b/\t} +echo 20 "${a//b/\t}" diff --git a/shell/ash_test/ash-vars/var_bash4.right b/shell/ash_test/ash-vars/var_bash4.right new file mode 100644 index 000000000..33a511238 --- /dev/null +++ b/shell/ash_test/ash-vars/var_bash4.right @@ -0,0 +1,2 @@ +a*b-backslashstar- +Done: 0 diff --git a/shell/ash_test/ash-vars/var_bash4.tests b/shell/ash_test/ash-vars/var_bash4.tests new file mode 100755 index 000000000..304b3d91c --- /dev/null +++ b/shell/ash_test/ash-vars/var_bash4.tests @@ -0,0 +1,3 @@ +FOO='a*b\*c' +echo "${FOO//\\*/-backslashstar-}" +echo Done: $? -- cgit v1.2.3-55-g6feb From 6814cbc9288601840aedb372e2bd84dab76ffa43 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 5 Aug 2010 18:29:13 +0200 Subject: ash: extend var_bash4.tests; nocode changes Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-vars/var_bash4.right | 4 +++- shell/ash_test/ash-vars/var_bash4.tests | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'shell') diff --git a/shell/ash_test/ash-vars/var_bash4.right b/shell/ash_test/ash-vars/var_bash4.right index 33a511238..fc3a9e41c 100644 --- a/shell/ash_test/ash-vars/var_bash4.right +++ b/shell/ash_test/ash-vars/var_bash4.right @@ -1,2 +1,4 @@ -a*b-backslashstar- +In assignment: a*b-backslashstar- +Unquoted: a*b-backslashstar- +Quoted: a*b-backslashstar- Done: 0 diff --git a/shell/ash_test/ash-vars/var_bash4.tests b/shell/ash_test/ash-vars/var_bash4.tests index 304b3d91c..3b323c576 100755 --- a/shell/ash_test/ash-vars/var_bash4.tests +++ b/shell/ash_test/ash-vars/var_bash4.tests @@ -1,3 +1,6 @@ FOO='a*b\*c' -echo "${FOO//\\*/-backslashstar-}" +BAR=${FOO//\\*/-backslashstar-} +echo In assignment: "$BAR" +echo Unquoted: ${FOO//\\*/-backslashstar-} +echo Quoted: "${FOO//\\*/-backslashstar-}" echo Done: $? -- cgit v1.2.3-55-g6feb