summaryrefslogtreecommitdiff
path: root/src/shutdown/s6-linux-init-hpr.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-06 17:11:28 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-06 17:11:28 +0000
commit7aa18bcbd83c4342bc2eefa4d6d96756ae7541a0 (patch)
tree157e1787d165dd052b2d49772887e31f49394c68 /src/shutdown/s6-linux-init-hpr.c
parent4d47d83042e0844da2fcfff9bd73de60124e7902 (diff)
downloads6-linux-init-7aa18bcbd83c4342bc2eefa4d6d96756ae7541a0.tar.xz
Add -i option to shutdown and hpr
Diffstat (limited to 'src/shutdown/s6-linux-init-hpr.c')
-rw-r--r--src/shutdown/s6-linux-init-hpr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/shutdown/s6-linux-init-hpr.c b/src/shutdown/s6-linux-init-hpr.c
index d3cd74b..4ce4135 100644
--- a/src/shutdown/s6-linux-init-hpr.c
+++ b/src/shutdown/s6-linux-init-hpr.c
@@ -29,7 +29,7 @@
#define _PATH_WTMP "/dev/null/wtmp"
#endif
-#define USAGE "s6-linux-init-hpr [ -h | -p | -r ] [ -n ] [ -d | -w ] [ -W ] [ -f ]"
+#define USAGE "s6-linux-init-hpr [ -h | -p | -r ] [ -n ] [ -d | -w ] [ -W ] [ -f ] [ -i ]"
int main (int argc, char const *const *argv)
{
@@ -38,13 +38,14 @@ int main (int argc, char const *const *argv)
int dowtmp = 1 ;
int dowall = 1 ;
int dosync = 1 ;
+ int doconfirm = 0 ;
PROG = "s6-linux-init-hpr" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "hprfdwWn", &l) ;
+ int opt = subgetopt_r(argc, argv, "hprfdwWni", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -56,6 +57,7 @@ int main (int argc, char const *const *argv)
case 'w' : dowtmp = 2 ; break ;
case 'W' : dowall = 0 ; break ;
case 'n' : dosync = 0 ; break ;
+ case 'i' : doconfirm = 0 ; break ;
default : strerr_dieusage(100, USAGE) ;
}
}
@@ -71,6 +73,8 @@ int main (int argc, char const *const *argv)
strerr_dief1sys(100, "nice try, peon") ;
}
+ if (doconfirm) hpr_confirm_hostname() ;
+
if (force)
{
if (dosync) sync() ;