diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-03-19 12:33:27 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-03-19 12:33:27 +0000 |
commit | d18999790c462bc780bff457e6bb03cd88e488f3 (patch) | |
tree | 299f9b86d74b10d5b63195c56e3fd9ba75d8f93f /src | |
parent | 96893711ec76b3c3b554313d7e97560b3cd62179 (diff) | |
download | s6-linux-utils-d18999790c462bc780bff457e6bb03cd88e488f3.tar.gz s6-linux-utils-d18999790c462bc780bff457e6bb03cd88e488f3.tar.xz s6-linux-utils-d18999790c462bc780bff457e6bb03cd88e488f3.zip |
Changes to s6-halt/s6-reboot/s6-poweroff. Default behaviour changed.
Major version bump: rc for 2.1.0.0
Diffstat (limited to 'src')
-rw-r--r-- | src/minutils/deps-exe/halt | 1 | ||||
-rw-r--r-- | src/minutils/deps-exe/poweroff | 1 | ||||
-rw-r--r-- | src/minutils/deps-exe/reboot | 1 | ||||
-rw-r--r-- | src/minutils/halt.c | 7 | ||||
-rw-r--r-- | src/minutils/hpr.c | 21 | ||||
-rw-r--r-- | src/minutils/poweroff.c | 7 | ||||
-rw-r--r-- | src/minutils/reboot.c | 7 | ||||
-rw-r--r-- | src/minutils/s6-halt.c | 16 | ||||
-rw-r--r-- | src/minutils/s6-poweroff.c | 16 | ||||
-rw-r--r-- | src/minutils/s6-reboot.c | 16 |
10 files changed, 23 insertions, 70 deletions
diff --git a/src/minutils/deps-exe/halt b/src/minutils/deps-exe/halt deleted file mode 100644 index e7187fe..0000000 --- a/src/minutils/deps-exe/halt +++ /dev/null @@ -1 +0,0 @@ --lskarnet diff --git a/src/minutils/deps-exe/poweroff b/src/minutils/deps-exe/poweroff deleted file mode 100644 index e7187fe..0000000 --- a/src/minutils/deps-exe/poweroff +++ /dev/null @@ -1 +0,0 @@ --lskarnet diff --git a/src/minutils/deps-exe/reboot b/src/minutils/deps-exe/reboot deleted file mode 100644 index e7187fe..0000000 --- a/src/minutils/deps-exe/reboot +++ /dev/null @@ -1 +0,0 @@ --lskarnet diff --git a/src/minutils/halt.c b/src/minutils/halt.c deleted file mode 100644 index 8ef9ef4..0000000 --- a/src/minutils/halt.c +++ /dev/null @@ -1,7 +0,0 @@ -/* ISC license. */ - -#undef PROGNAME -#define PROGNAME "halt" -#undef WHATDEFAULT -#define WHATDEFAULT 1 -#include "hpr.c" diff --git a/src/minutils/hpr.c b/src/minutils/hpr.c index d78470e..0e1c27a 100644 --- a/src/minutils/hpr.c +++ b/src/minutils/hpr.c @@ -6,7 +6,7 @@ #include <skalibs/strerr2.h> #include <skalibs/sgetopt.h> -#define USAGE PROGNAME " [ -h | -p | -r ] [ -f ] [ -w | -d ]" +#define USAGE PROGNAME " [ -h | -p | -r ] [ -f ]" int main (int argc, char const *const *argv) { @@ -18,7 +18,7 @@ int main (int argc, char const *const *argv) subgetopt_t l = SUBGETOPT_ZERO ; for (;;) { - register int opt = subgetopt_r(argc, argv, "hprfwd", &l) ; + register int opt = subgetopt_r(argc, argv, "hprf", &l) ; if (opt == -1) break ; switch (opt) { @@ -26,24 +26,19 @@ int main (int argc, char const *const *argv) case 'p' : what = 2 ; break ; case 'r' : what = 3 ; break ; case 'f' : force = 1 ; break ; - case 'w' : what = 0 ; break ; - case 'd' : break ; default : strerr_dieusage(100, USAGE) ; } } argc -= l.ind ; argv += l.ind ; } - if (what) + if (force) { - if (force) - { - sync() ; - reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWER_OFF : RB_HALT_SYSTEM) ; - strerr_diefu1sys(111, "reboot()") ; - } - else if (kill(1, what == 3 ? SIGINT : what == 2 ? SIGUSR1 : SIGUSR2) < 0) - strerr_diefu1sys(111, "signal process 1") ; + sync() ; + reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWER_OFF : RB_HALT_SYSTEM) ; + strerr_diefu1sys(111, "reboot()") ; } + else if (kill(1, what == 3 ? SIGINT : what == 2 ? SIGUSR1 : SIGUSR2) < 0) + strerr_diefu1sys(111, "signal process 1") ; return 0 ; } diff --git a/src/minutils/poweroff.c b/src/minutils/poweroff.c deleted file mode 100644 index 2856aac..0000000 --- a/src/minutils/poweroff.c +++ /dev/null @@ -1,7 +0,0 @@ -/* ISC license. */ - -#undef PROGNAME -#define PROGNAME "poweroff" -#undef WHATDEFAULT -#define WHATDEFAULT 2 -#include "hpr.c" diff --git a/src/minutils/reboot.c b/src/minutils/reboot.c deleted file mode 100644 index 12480d4..0000000 --- a/src/minutils/reboot.c +++ /dev/null @@ -1,7 +0,0 @@ -/* ISC license. */ - -#undef PROGNAME -#define PROGNAME "reboot" -#undef WHATDEFAULT -#define WHATDEFAULT 3 -#include "hpr.c" diff --git a/src/minutils/s6-halt.c b/src/minutils/s6-halt.c index 9613017..d758030 100644 --- a/src/minutils/s6-halt.c +++ b/src/minutils/s6-halt.c @@ -1,13 +1,7 @@ /* ISC license. */ -#include <unistd.h> -#include <sys/reboot.h> -#include <skalibs/strerr2.h> - -int main () -{ - PROG = "s6-halt" ; - sync() ; - reboot(RB_HALT_SYSTEM) ; - strerr_diefu1sys(111, "reboot()") ; -} +#undef PROGNAME +#define PROGNAME "s6-halt" +#undef WHATDEFAULT +#define WHATDEFAULT 1 +#include "hpr.c" diff --git a/src/minutils/s6-poweroff.c b/src/minutils/s6-poweroff.c index b3576b3..f9f7747 100644 --- a/src/minutils/s6-poweroff.c +++ b/src/minutils/s6-poweroff.c @@ -1,13 +1,7 @@ /* ISC license. */ -#include <unistd.h> -#include <sys/reboot.h> -#include <skalibs/strerr2.h> - -int main () -{ - PROG = "s6-poweroff" ; - sync() ; - reboot(RB_POWER_OFF) ; - strerr_diefu1sys(111, "reboot()") ; -} +#undef PROGNAME +#define PROGNAME "s6-poweroff" +#undef WHATDEFAULT +#define WHATDEFAULT 2 +#include "hpr.c" diff --git a/src/minutils/s6-reboot.c b/src/minutils/s6-reboot.c index f006b35..0bf8785 100644 --- a/src/minutils/s6-reboot.c +++ b/src/minutils/s6-reboot.c @@ -1,13 +1,7 @@ /* ISC license. */ -#include <unistd.h> -#include <sys/reboot.h> -#include <skalibs/strerr2.h> - -int main () -{ - PROG = "s6-reboot" ; - sync() ; - reboot(RB_AUTOBOOT) ; - strerr_diefu1sys(111, "reboot()") ; -} +#undef PROGNAME +#define PROGNAME "s6-reboot" +#undef WHATDEFAULT +#define WHATDEFAULT 3 +#include "hpr.c" |