aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-18 16:48:56 +0000
committerRoy Marples <roy@marples.name>2007-12-18 16:48:56 +0000
commit05a9d0e25e343a2bb574a0c94f00fee19eec0622 (patch)
treee57374573ed48372cb1400eb615da3c690f8646d
parente4b73c506b85727e1a77f6c0feffe3aa8c17a099 (diff)
Allow service_* functions to work off SVCNAME if no arguments passed
-rw-r--r--src/rc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rc.c b/src/rc.c
index afc41488..93f47f50 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -300,8 +300,14 @@ static int do_e (int argc, char **argv)
static int do_service (int argc, char **argv)
{
bool ok = false;
+ char *service = NULL;
- if (argc < 1 || ! argv[0] || strlen (argv[0]) == 0)
+ if (argc > 0)
+ service = argv[0];
+ else
+ service = getenv ("SVCNAME");
+
+ if (! service || strlen (service) == 0)
eerrorx ("%s: no service specified", applet);
if (strcmp (applet, "service_started") == 0)