From 69a040bf85e59043dbc6dbb9f67260ed91a93cd5 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 14 Nov 2007 16:19:56 +0000 Subject: Show help if we don't have any args, Gentoo #198380. --- src/runscript.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/runscript.c') diff --git a/src/runscript.c b/src/runscript.c index 63453374..7bdde764 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -990,10 +990,17 @@ int runscript (int argc, char **argv) int opt; char *svc; + /* Show help if insufficient args */ + if (argc < 2) { + execl (RCSCRIPT_HELP, RCSCRIPT_HELP, (char *) NULL); + eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s", argv[0], + strerror (errno)); + } + /* We need the full path to the service */ - if (! realpath (argv[0], service)) + if (! realpath (argv[1], service)) eerrorx ("unable to resolve the path `%s': %s", - argv[0], strerror (errno)); + argv[1], strerror (errno)); applet = xstrdup (basename (service)); atexit (cleanup); -- cgit v1.2.3