wok annotate busybox/stuff/busybox-1.32-shutdown.u @ rev 23912

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