summaryrefslogtreecommitdiff
path: root/src/shutdown/s6-linux-init-shutdown.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-06-09 08:55:43 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-06-09 08:55:43 +0000
commit55691b5e18ba7cd23c521eb8d54d5f2e4a7d0ea5 (patch)
tree4896c7a4379ac19e18cab58f26e44c6000b0d998 /src/shutdown/s6-linux-init-shutdown.c
parente070685b6b0077f93b281b5959740a6cc205cfc6 (diff)
downloads6-linux-init-55691b5e18ba7cd23c521eb8d54d5f2e4a7d0ea5.tar.xz
Add -H and -P to s6-l-i-shutdown, prepare for 1.0.2.0
Diffstat (limited to 'src/shutdown/s6-linux-init-shutdown.c')
-rw-r--r--src/shutdown/s6-linux-init-shutdown.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/shutdown/s6-linux-init-shutdown.c b/src/shutdown/s6-linux-init-shutdown.c
index 8e310ec..306bee0 100644
--- a/src/shutdown/s6-linux-init-shutdown.c
+++ b/src/shutdown/s6-linux-init-shutdown.c
@@ -27,7 +27,7 @@
#define UT_NAMESIZE 32
#endif
-#define USAGE "s6-linux-init-shutdown [ -h | -p | -r | -k ] [ -f | -F ] [ -a ] [ -t sec ] time [ message ] or s6-linux-init-shutdown -c [ message ]"
+#define USAGE "s6-linux-init-shutdown [ -h [ -H | -P ] | -p | -r | -k ] [ -f | -F ] [ -a ] [ -t sec ] time [ message ] or s6-linux-init-shutdown -c [ message ]"
#define dieusage() strerr_dieusage(100, USAGE)
#define AC_FILE "/etc/shutdown.allow"
@@ -195,6 +195,7 @@ int main (int argc, char const *const *argv)
{
unsigned int gracetime = 0 ;
int what = 0 ;
+ int subwhat = 0 ;
int doactl = 0 ;
int docancel = 0 ;
tain_t when ;
@@ -204,10 +205,12 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "hprkafFct:", &l) ;
+ int opt = subgetopt_r(argc, argv, "HPhprkafFct:", &l) ;
if (opt == -1) break ;
switch (opt)
{
+ case 'H' : subwhat = 1 ; break ;
+ case 'P' : subwhat = 2 ; break ;
case 'h' : what = 1 ; break ;
case 'p' : what = 2 ; break ;
case 'r' : what = 3 ; break ;
@@ -223,6 +226,11 @@ int main (int argc, char const *const *argv)
argc -= l.ind ; argv += l.ind ;
}
+ if (subwhat)
+ {
+ if (what == 1) what = subwhat ;
+ else strerr_dieusage(100, USAGE) ;
+ }
if (geteuid())
{
errno = EPERM ;