diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-08-28 17:18:08 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-08-28 17:18:08 +0000 |
commit | fa7f29ff4b5aef142143e9c1d887d73788b703e4 (patch) | |
tree | 0ec096b01f94af5a376e37d8720c35f936c449bb /src/supervision/s6-svdir-unlink.c | |
parent | 8f00f3a276b4fde40bcd0ddaa4dc89d2b5791d89 (diff) | |
download | s6-fa7f29ff4b5aef142143e9c1d887d73788b703e4.tar.xz |
Add s6-svdir-link and s6-svdir-unlink
Not tested yet; not documented yet; to come soon.
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/supervision/s6-svdir-unlink.c')
-rw-r--r-- | src/supervision/s6-svdir-unlink.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/supervision/s6-svdir-unlink.c b/src/supervision/s6-svdir-unlink.c new file mode 100644 index 0000000..88eedbe --- /dev/null +++ b/src/supervision/s6-svdir-unlink.c @@ -0,0 +1,36 @@ +/* ISC license. */ + +#include <stdint.h> + +#include <skalibs/sgetopt.h> +#include <skalibs/strerr2.h> + +#include <s6/s6-supervise.h> + +#define USAGE "s6-svdir-unlink [ -d ] [ -x ] scandir servicename" +#define dieusage() strerr_dieusage(100, USAGE) + +int main (int argc, char const *const *argv) +{ + uint32_t options = 0 ; + PROG = "s6-svdir-link" ; + { + subgetopt l = SUBGETOPT_ZERO ; + for (;;) + { + int opt = subgetopt_r(argc, argv, "dx", &l) ; + if (opt == -1) break ; + switch (opt) + { + case 'd' : options = 3 ; break ; + case 'x' : options = 1 ; break ; + default : dieusage() ; + } + } + argc -= l.ind ; argv += l.ind ; + } + if (argc < 2) dieusage() ; + + s6_supervise_unlink(argv[0], argv[1], options) ; + return 0 ; +} |