From d18999790c462bc780bff457e6bb03cd88e488f3 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 19 Mar 2016 12:33:27 +0000 Subject: Changes to s6-halt/s6-reboot/s6-poweroff. Default behaviour changed. Major version bump: rc for 2.1.0.0 --- src/minutils/deps-exe/halt | 1 - src/minutils/deps-exe/poweroff | 1 - src/minutils/deps-exe/reboot | 1 - src/minutils/halt.c | 7 ------- src/minutils/hpr.c | 21 ++++++++------------- src/minutils/poweroff.c | 7 ------- src/minutils/reboot.c | 7 ------- src/minutils/s6-halt.c | 16 +++++----------- src/minutils/s6-poweroff.c | 16 +++++----------- src/minutils/s6-reboot.c | 16 +++++----------- 10 files changed, 23 insertions(+), 70 deletions(-) delete mode 100644 src/minutils/deps-exe/halt delete mode 100644 src/minutils/deps-exe/poweroff delete mode 100644 src/minutils/deps-exe/reboot delete mode 100644 src/minutils/halt.c delete mode 100644 src/minutils/poweroff.c delete mode 100644 src/minutils/reboot.c (limited to 'src/minutils') 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 #include -#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 -#include -#include - -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 -#include -#include - -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 -#include -#include - -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" -- cgit v1.2.3