aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-05-14 19:00:04 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-05-14 19:00:04 -0500
commita7f475ca04856ef8232364c5b0c3191566b0696c (patch)
treeec685e5e54af4a3c164d2440e2f357b382796f90 /src/rc
parent3c53680018c1799d0d804e241a9fa4d3b9423896 (diff)
rc-service: add a --dry-run option
This is for #225.
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-service.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
index 8e7b00dc..77f0336b 100644
--- a/src/rc/rc-service.c
+++ b/src/rc/rc-service.c
@@ -29,7 +29,7 @@
const char *applet = NULL;
const char *extraopts = NULL;
-const char *getoptstring = "ce:ilr:IN" getoptstring_COMMON;
+const char *getoptstring = "ce:ilr:INZ" getoptstring_COMMON;
const struct option longopts[] = {
{ "exists", 1, NULL, 'e' },
{ "ifcrashed", 0, NULL, 'c' },
@@ -38,6 +38,7 @@ const struct option longopts[] = {
{ "ifnotstarted", 0, NULL, 'N' },
{ "list", 0, NULL, 'l' },
{ "resolve", 1, NULL, 'r' },
+ { "dry-run", 0, NULL, 'Z' },
longopts_COMMON
};
const char * const longopts_help[] = {
@@ -48,6 +49,7 @@ const char * const longopts_help[] = {
"if the service is not started then run the command",
"list all available services",
"resolve the service name to an init script",
+ "dry run (show what would happen)",
longopts_help_COMMON
};
const char *usagestring = "" \
@@ -112,6 +114,9 @@ int main(int argc, char **argv)
free(service);
return EXIT_SUCCESS;
/* NOTREACHED */
+ case 'Z':
+ setenv("IN_DRYRUN", "yes", 1);
+ break;
case_RC_COMMON_GETOPT
}