wok annotate busybox/stuff/busybox-1.23-shutdown.u @ rev 19159
/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu May 26 20:16:45 2016 +0300 (2016-05-26) |
parents | |
children |
rev | line source |
---|---|
pascal@18429 | 1 --- busybox-1.23/init/halt.c |
pascal@18429 | 2 +++ busybox-1.23/init/halt.c |
pascal@18429 | 3 @@ -10,6 +10,7 @@ |
pascal@18429 | 4 //applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP)) |
pascal@18429 | 5 //applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff)) |
pascal@18429 | 6 //applet:IF_HALT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot)) |
pascal@18429 | 7 +//applet:IF_HALT(APPLET_ODDNAME(shutdown, halt, BB_DIR_SBIN, BB_SUID_DROP, shutdown)) |
pascal@18429 | 8 |
pascal@18429 | 9 //kbuild:lib-$(CONFIG_HALT) += halt.o |
pascal@18429 | 10 |
pascal@18429 | 11 @@ -65,6 +66,15 @@ |
pascal@18429 | 12 //usage: "\n -d SEC Delay interval" |
pascal@18429 | 13 //usage: "\n -n Do not sync" |
pascal@18429 | 14 //usage: "\n -f Force (don't go through init)" |
pascal@18429 | 15 +//usage: |
pascal@18429 | 16 +//usage:#define shutdown_trivial_usage |
pascal@18429 | 17 +//usage: "[-rhHP]" |
pascal@18429 | 18 +//usage:#define shutdown_full_usage "\n\n" |
pascal@18429 | 19 +//usage: "Bring the system down\n" |
pascal@18429 | 20 +//usage: "\n -r Do reboot" |
pascal@18429 | 21 +//usage: "\n -h Do poweroff" |
pascal@18429 | 22 +//usage: "\n -H Do halt" |
pascal@18429 | 23 +//usage: "\n -P Do poweroff" |
pascal@18429 | 24 |
pascal@18429 | 25 #include "libbb.h" |
pascal@18429 | 26 #include "reboot.h" |
pascal@18429 | 27 @@ -98,6 +108,7 @@ |
pascal@18429 | 28 int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
pascal@18429 | 29 int halt_main(int argc UNUSED_PARAM, char **argv) |
pascal@18429 | 30 { |
pascal@18429 | 31 + enum { HALT=0, POWEROFF=1, REBOOT=2, SHUTDOWN=3 }; |
pascal@18429 | 32 static const int magic[] = { |
pascal@18429 | 33 RB_HALT_SYSTEM, |
pascal@18429 | 34 RB_POWER_OFF, |
pascal@18429 | 35 @@ -109,9 +120,19 @@ |
pascal@18429 | 36 int which, flags, rc; |
pascal@18429 | 37 |
pascal@18429 | 38 /* Figure out which applet we're running */ |
pascal@18429 | 39 - for (which = 0; "hpr"[which] != applet_name[0]; which++) |
pascal@18429 | 40 + for (which = 0; "hprs"[which] != applet_name[0]; which++) |
pascal@18429 | 41 continue; |
pascal@18429 | 42 |
pascal@18429 | 43 + if (which == SHUTDOWN) { |
pascal@18429 | 44 + which = REBOOT; |
pascal@18429 | 45 + switch (getopt32(argv, "rhPH")) { |
pascal@18429 | 46 + case 2: |
pascal@18429 | 47 + case 4: which = POWEROFF; break; |
pascal@18429 | 48 + case 8: which = HALT; |
pascal@18429 | 49 + } |
pascal@18429 | 50 + flags = 0; |
pascal@18429 | 51 + } |
pascal@18429 | 52 + else { |
pascal@18429 | 53 /* Parse and handle arguments */ |
pascal@18429 | 54 opt_complementary = "d+"; /* -d N */ |
pascal@18429 | 55 /* We support -w even if !ENABLE_FEATURE_WTMP, |
pascal@18429 | 56 @@ -119,6 +140,7 @@ |
pascal@18429 | 57 * -i (shut down network interfaces) is ignored. |
pascal@18429 | 58 */ |
pascal@18429 | 59 flags = getopt32(argv, "d:nfwi", &delay); |
pascal@18429 | 60 + } |
pascal@18429 | 61 |
pascal@18429 | 62 sleep(delay); |
pascal@18429 | 63 |