aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-05-15 16:59:21 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-05-15 16:59:21 -0500
commit4d47ce440c3e8f193cff82a77e6691ee6e7fac33 (patch)
treeb3d4a3de30280175de566522be73868ce9f1965e /src/rc
parent958f57d895b6573b39e62097e5e9881f16174715 (diff)
rc-service: add -d/--debug and -D/--nodeps options
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-service.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
index 77f0336b..ea69dab5 100644
--- a/src/rc/rc-service.c
+++ b/src/rc/rc-service.c
@@ -29,8 +29,10 @@
const char *applet = NULL;
const char *extraopts = NULL;
-const char *getoptstring = "ce:ilr:INZ" getoptstring_COMMON;
+const char *getoptstring = "cdDe:ilr:INZ" getoptstring_COMMON;
const struct option longopts[] = {
+ { "debug", 0, NULL, 'd' },
+ { "nodeps", 0, NULL, 'D' },
{ "exists", 1, NULL, 'e' },
{ "ifcrashed", 0, NULL, 'c' },
{ "ifexists", 0, NULL, 'i' },
@@ -42,6 +44,8 @@ const struct option longopts[] = {
longopts_COMMON
};
const char * const longopts_help[] = {
+ "set xtrace when running the command",
+ "ignore dependencies",
"tests if the service exists or not",
"if the service is crashed then run the command",
"if the service exists then run the command",
@@ -78,6 +82,12 @@ int main(int argc, char **argv)
longopts, (int *) 0)) != -1)
{
switch (opt) {
+ case 'd':
+ setenv("RC_DEBUG", "yes", 1);
+ break;
+ case 'D':
+ setenv("RC_NODEPS", "yes", 1);
+ break;
case 'e':
service = rc_service_resolve(optarg);
opt = service ? EXIT_SUCCESS : EXIT_FAILURE;