wok annotate busybox/stuff/busybox-1.30-shutdown.u @ rev 21178

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