summary refs log tree commit diff
path: root/src/minutils/hpr.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-09-10 13:42:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-09-10 13:42:04 +0000
commit5928bf00c094a250c3d9cc4346075cd65c87e865 (patch)
treed9d00749c1ea23c6df7af35be5517631830d1cb4 /src/minutils/hpr.c
parenta19ce7bb451236b79ac79d7ffc8e8fa12323ea0d (diff)
downloads6-linux-utils-5928bf00c094a250c3d9cc4346075cd65c87e865.tar.gz
s6-linux-utils-5928bf00c094a250c3d9cc4346075cd65c87e865.tar.xz
s6-linux-utils-5928bf00c094a250c3d9cc4346075cd65c87e865.zip
Remove s6-halt, s6-poweroff and s6-reboot (moved to the s6-linux-init package)
Diffstat (limited to 'src/minutils/hpr.c')
-rw-r--r--src/minutils/hpr.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/minutils/hpr.c b/src/minutils/hpr.c
deleted file mode 100644
index 0e1c27a..0000000
--- a/src/minutils/hpr.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-#include <signal.h>
-#include <sys/reboot.h>
-#include <skalibs/strerr2.h>
-#include <skalibs/sgetopt.h>
-
-#define USAGE PROGNAME " [ -h | -p | -r ] [ -f ]"
-
-int main (int argc, char const *const *argv)
-{
-  int what = WHATDEFAULT ;
-  int force = 0 ;
-  PROG = PROGNAME ;
-
-  {
-    subgetopt_t l = SUBGETOPT_ZERO ;
-    for (;;)
-    {
-      register int opt = subgetopt_r(argc, argv, "hprf", &l) ;
-      if (opt == -1) break ;
-      switch (opt)
-      {
-        case 'h' : what = 1 ; break ;
-        case 'p' : what = 2 ; break ;
-        case 'r' : what = 3 ; break ;
-        case 'f' : force = 1 ; break ;
-        default : strerr_dieusage(100, USAGE) ;
-      }
-    }
-    argc -= l.ind ; argv += l.ind ;
-  }
-
-  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") ;
-  return 0 ;
-}