wok annotate busybox/stuff/busybox-1.28-shutdown.u @ rev 20550

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