wok annotate busybox/stuff/busybox-1.26-shutdown.u @ rev 19979

Add seamonkey-official
author Richard Dunbar <mojo@slitaz.org>
date Tue Jun 13 14:11:14 2017 -0400 (2017-06-13)
parents
children
rev   line source
pascal@19610 1 --- busybox-1.26/init/halt.c
pascal@19610 2 +++ busybox-1.26/init/halt.c
pascal@19610 3 @@ -48,6 +48,7 @@
pascal@19610 4 //applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
pascal@19610 5 //applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
pascal@19610 6 //applet:IF_REBOOT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
pascal@19610 7 +//applet:IF_REBOOT(APPLET_ODDNAME(shutdown, halt, BB_DIR_SBIN, BB_SUID_DROP, shutdown))
pascal@19610 8
pascal@19610 9 //kbuild:lib-$(CONFIG_HALT) += halt.o
pascal@19610 10 //kbuild:lib-$(CONFIG_POWEROFF) += halt.o
pascal@19610 11 @@ -79,6 +80,15 @@
pascal@19610 12 //usage: "\n -d SEC Delay interval"
pascal@19610 13 //usage: "\n -n Do not sync"
pascal@19610 14 //usage: "\n -f Force (don't go through init)"
pascal@19610 15 +//usage:
pascal@19610 16 +//usage:#define shutdown_trivial_usage
pascal@19610 17 +//usage: "[-rhHP]"
pascal@19610 18 +//usage:#define shutdown_full_usage "\n\n"
pascal@19610 19 +//usage: "Bring the system down\n"
pascal@19610 20 +//usage: "\n -r Do reboot"
pascal@19610 21 +//usage: "\n -h Do poweroff"
pascal@19610 22 +//usage: "\n -H Do halt"
pascal@19610 23 +//usage: "\n -P Do poweroff"
pascal@19610 24
pascal@19610 25 #include "libbb.h"
pascal@19610 26 #include "reboot.h"
pascal@19610 27 @@ -112,6 +122,7 @@
pascal@19610 28 int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
pascal@19610 29 int halt_main(int argc UNUSED_PARAM, char **argv)
pascal@19610 30 {
pascal@19610 31 + enum { HALT=0, POWEROFF=1, REBOOT=2, SHUTDOWN=3 };
pascal@19610 32 static const int magic[] = {
pascal@19610 33 RB_HALT_SYSTEM,
pascal@19610 34 RB_POWER_OFF,
pascal@19610 35 @@ -132,15 +143,26 @@
pascal@19610 36 if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT)
pascal@19610 37 which = 2;
pascal@19610 38 else
pascal@19610 39 - for (which = 0; "hpr"[which] != applet_name[0]; which++)
pascal@19610 40 + for (which = 0; "hprs"[which] != applet_name[0]; which++)
pascal@19610 41 continue;
pascal@19610 42
pascal@19610 43 + if (which == SHUTDOWN) {
pascal@19610 44 + which = REBOOT;
pascal@19610 45 + switch (getopt32(argv, "rhPH")) {
pascal@19610 46 + case 2:
pascal@19610 47 + case 4: which = POWEROFF; break;
pascal@19610 48 + case 8: which = HALT;
pascal@19610 49 + }
pascal@19610 50 + flags = 0;
pascal@19610 51 + }
pascal@19610 52 + else {
pascal@19610 53 /* Parse and handle arguments */
pascal@19610 54 /* We support -w even if !ENABLE_FEATURE_WTMP,
pascal@19610 55 * in order to not break scripts.
pascal@19610 56 * -i (shut down network interfaces) is ignored.
pascal@19610 57 */
pascal@19610 58 flags = getopt32(argv, "d:+nfwi", &delay);
pascal@19610 59 + }
pascal@19610 60
pascal@19610 61 sleep(delay);
pascal@19610 62