aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc-service.c
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2015-12-23 14:06:31 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2016-01-12 10:42:14 -0600
commitbf2f40828ee26d3ba9185f29db596ee5d7b9cf61 (patch)
treede1ccdb2fd86e476323908c37ae6588a9ac9ae97 /src/rc/rc-service.c
parentfe485f44339963fdbee143687dcbef2069924bc6 (diff)
Remove multicall binary structure from OpenRC
This eliminates the need for the selinux-specific wrapper scrript we were installing in /lib*/rc/{bin,sbin}.
Diffstat (limited to 'src/rc/rc-service.c')
-rw-r--r--src/rc/rc-service.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
index 6b03767b..8e9da446 100644
--- a/src/rc/rc-service.c
+++ b/src/rc/rc-service.c
@@ -21,39 +21,36 @@
#include <string.h>
#include <unistd.h>
-#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
-
-extern char *applet;
-
#include "_usage.h"
-#define usagestring "" \
- "Usage: rc-service [options] [-i] <service> <cmd>...\n" \
- " or: rc-service [options] -e <service>\n" \
- " or: rc-service [options] -l\n" \
- " or: rc-service [options] -r <service>"
-#define getoptstring "e:ilr:" getoptstring_COMMON
-static const struct option longopts[] = {
+
+const char *applet = NULL;
+const char *extraopts = NULL;
+const char *getoptstring = "e:ilr:" getoptstring_COMMON;
+const struct option longopts[] = {
{ "exists", 1, NULL, 'e' },
{ "ifexists", 0, NULL, 'i' },
{ "list", 0, NULL, 'l' },
{ "resolve", 1, NULL, 'r' },
longopts_COMMON
};
-static const char * const longopts_help[] = {
+const char * const longopts_help[] = {
"tests if the service exists or not",
"if the service exists then run the command",
"list all available services",
"resolve the service name to an init script",
longopts_help_COMMON
};
-#include "_usage.c"
+const char *usagestring = "" \
+ "Usage: rc-service [options] [-i] <service> <cmd>...\n" \
+ " or: rc-service [options] -e <service>\n" \
+ " or: rc-service [options] -l\n" \
+ " or: rc-service [options] -r <service>";
-int
-rc_service(int argc, char **argv)
+int main(int argc, char **argv)
{
int opt;
char *service;
@@ -61,6 +58,7 @@ rc_service(int argc, char **argv)
RC_STRING *s;
bool if_exists = false;
+ applet = basename_c(argv[0]);
/* Ensure that we are only quiet when explicitly told to be */
unsetenv("EINFO_QUIET");