wok diff busybox/stuff/busybox-1.23-shutdown.u @ rev 18635

mediainfo: add build depends
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Nov 27 10:38:59 2015 +0200 (2015-11-27)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.23-shutdown.u	Fri Nov 27 10:38:59 2015 +0200
     1.3 @@ -0,0 +1,63 @@
     1.4 +--- busybox-1.23/init/halt.c
     1.5 ++++ busybox-1.23/init/halt.c
     1.6 +@@ -10,6 +10,7 @@
     1.7 + //applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
     1.8 + //applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
     1.9 + //applet:IF_HALT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
    1.10 ++//applet:IF_HALT(APPLET_ODDNAME(shutdown, halt, BB_DIR_SBIN, BB_SUID_DROP, shutdown))
    1.11 + 
    1.12 + //kbuild:lib-$(CONFIG_HALT) += halt.o
    1.13 + 
    1.14 +@@ -65,6 +66,15 @@
    1.15 + //usage:     "\n	-d SEC	Delay interval"
    1.16 + //usage:     "\n	-n	Do not sync"
    1.17 + //usage:     "\n	-f	Force (don't go through init)"
    1.18 ++//usage:
    1.19 ++//usage:#define shutdown_trivial_usage
    1.20 ++//usage:       "[-rhHP]"
    1.21 ++//usage:#define shutdown_full_usage "\n\n"
    1.22 ++//usage:       "Bring the system down\n"
    1.23 ++//usage:     "\n	-r	Do reboot"
    1.24 ++//usage:     "\n	-h	Do poweroff"
    1.25 ++//usage:     "\n	-H	Do halt"
    1.26 ++//usage:     "\n	-P	Do poweroff"
    1.27 + 
    1.28 + #include "libbb.h"
    1.29 + #include "reboot.h"
    1.30 +@@ -98,6 +108,7 @@
    1.31 + int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1.32 + int halt_main(int argc UNUSED_PARAM, char **argv)
    1.33 + {
    1.34 ++	enum { HALT=0, POWEROFF=1, REBOOT=2, SHUTDOWN=3 };
    1.35 + 	static const int magic[] = {
    1.36 + 		RB_HALT_SYSTEM,
    1.37 + 		RB_POWER_OFF,
    1.38 +@@ -109,9 +120,19 @@
    1.39 + 	int which, flags, rc;
    1.40 + 
    1.41 + 	/* Figure out which applet we're running */
    1.42 +-	for (which = 0; "hpr"[which] != applet_name[0]; which++)
    1.43 ++	for (which = 0; "hprs"[which] != applet_name[0]; which++)
    1.44 + 		continue;
    1.45 + 
    1.46 ++	if (which == SHUTDOWN) {
    1.47 ++		which = REBOOT;
    1.48 ++		switch (getopt32(argv, "rhPH")) {
    1.49 ++			case 2:
    1.50 ++			case 4: which = POWEROFF; break;
    1.51 ++			case 8: which = HALT;
    1.52 ++		}
    1.53 ++		flags = 0;
    1.54 ++	}
    1.55 ++	else {
    1.56 + 	/* Parse and handle arguments */
    1.57 + 	opt_complementary = "d+"; /* -d N */
    1.58 + 	/* We support -w even if !ENABLE_FEATURE_WTMP,
    1.59 +@@ -119,6 +140,7 @@
    1.60 + 	 * -i (shut down network interfaces) is ignored.
    1.61 + 	 */
    1.62 + 	flags = getopt32(argv, "d:nfwi", &delay);
    1.63 ++	}
    1.64 + 
    1.65 + 	sleep(delay);
    1.66 +