wok-6.x annotate busybox/stuff/busybox-1.31-shutdown.u @ rev 23018

updated libcdio-paranoia and libcdio-paranoia-dev (10.2+0.94+2 -> 10.2.2.0.1)
author Hans-G?nter Theisgen
date Tue Mar 03 13:55:44 2020 +0100 (2020-03-03)
parents
children
rev   line source
pascal@21761 1 --- busybox-1.31/init/halt.c
pascal@21761 2 +++ busybox-1.31/init/halt.c
pascal@21761 3 @@ -59,6 +59,7 @@
pascal@21761 4 // APPLET_ODDNAME:name main location suid_type help
pascal@21761 5 //applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
pascal@21761 6 //applet:IF_REBOOT( APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
pascal@21761 7 +//applet:IF_REBOOT( APPLET_ODDNAME(shutdown, halt, BB_DIR_SBIN, BB_SUID_DROP, shutdown))
pascal@21761 8
pascal@21761 9 //kbuild:lib-$(CONFIG_HALT) += halt.o
pascal@21761 10 //kbuild:lib-$(CONFIG_POWEROFF) += halt.o
pascal@21761 11 @@ -90,6 +91,15 @@
pascal@21761 12 //usage: "\n -d SEC Delay interval"
pascal@21761 13 //usage: "\n -n Do not sync"
pascal@21761 14 //usage: "\n -f Force (don't go through init)"
pascal@21761 15 +//usage:
pascal@21761 16 +//usage:#define shutdown_trivial_usage
pascal@21761 17 +//usage: "[-rhHP]"
pascal@21761 18 +//usage:#define shutdown_full_usage "\n\n"
pascal@21761 19 +//usage: "Bring the system down\n"
pascal@21761 20 +//usage: "\n -r Do reboot"
pascal@21761 21 +//usage: "\n -h Do poweroff"
pascal@21761 22 +//usage: "\n -H Do halt"
pascal@21761 23 +//usage: "\n -P Do poweroff"
pascal@21761 24
pascal@21761 25 #include "libbb.h"
pascal@21761 26 #include "reboot.h"
pascal@21761 27 @@ -164,6 +174,7 @@
pascal@21761 28 int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
pascal@21761 29 int halt_main(int argc UNUSED_PARAM, char **argv)
pascal@21761 30 {
pascal@21761 31 + enum { HALT=0, POWEROFF=1, REBOOT=2, SHUTDOWN=3 };
pascal@21761 32 static const int magic[] = {
pascal@21761 33 RB_HALT_SYSTEM,
pascal@21761 34 RB_POWER_OFF,
pascal@21761 35 @@ -184,15 +195,26 @@
pascal@21761 36 if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT)
pascal@21761 37 which = 2;
pascal@21761 38 else
pascal@21761 39 - for (which = 0; "hpr"[which] != applet_name[0]; which++)
pascal@21761 40 + for (which = 0; "hprs"[which] != applet_name[0]; which++)
pascal@21761 41 continue;
pascal@21761 42
pascal@21761 43 + if (which == SHUTDOWN) {
pascal@21761 44 + which = REBOOT;
pascal@21761 45 + switch (getopt32(argv, "rhPH")) {
pascal@21761 46 + case 2:
pascal@21761 47 + case 4: which = POWEROFF; break;
pascal@21761 48 + case 8: which = HALT;
pascal@21761 49 + }
pascal@21761 50 + flags = 0;
pascal@21761 51 + }
pascal@21761 52 + else {
pascal@21761 53 /* Parse and handle arguments */
pascal@21761 54 /* We support -w even if !ENABLE_FEATURE_WTMP,
pascal@21761 55 * in order to not break scripts.
pascal@21761 56 * -i (shut down network interfaces) is ignored.
pascal@21761 57 */
pascal@21761 58 flags = getopt32(argv, "d:+nfwi", &delay);
pascal@21761 59 + }
pascal@21761 60
pascal@21761 61 sleep(delay);
pascal@21761 62