summaryrefslogtreecommitdiff
path: root/src/minutils/hpr.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-03-19 12:33:27 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-03-19 12:33:27 +0000
commitd18999790c462bc780bff457e6bb03cd88e488f3 (patch)
tree299f9b86d74b10d5b63195c56e3fd9ba75d8f93f /src/minutils/hpr.c
parent96893711ec76b3c3b554313d7e97560b3cd62179 (diff)
downloads6-linux-utils-d18999790c462bc780bff457e6bb03cd88e488f3.tar.xz
Changes to s6-halt/s6-reboot/s6-poweroff. Default behaviour changed.
Major version bump: rc for 2.1.0.0
Diffstat (limited to 'src/minutils/hpr.c')
-rw-r--r--src/minutils/hpr.c21
1 files changed, 8 insertions, 13 deletions
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 ;
}