aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc-misc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-13 17:47:23 +0000
committerRoy Marples <roy@marples.name>2008-01-13 17:47:23 +0000
commit87e4e4410cb542f3b56989d02e088c5efdfaf157 (patch)
tree14ffb2f5a665b6a9015925a8fed2ed0bb5fdc164 /src/rc/rc-misc.c
parentabc7a79755c82ed5b6737901d71f8f7f15e1d992 (diff)
Remove rc_service_plugable function and make it private as it needs to read from our config file.
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r--src/rc/rc-misc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 0d6be40d..fe6022e2 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -387,3 +387,41 @@ char **env_config (void)
free (runlevel);
return (env);
}
+
+bool service_plugable (const char *service)
+{
+ char *list;
+ char *p;
+ char *star;
+ char *token;
+ bool allow = true;
+ char *match = rc_conf_value ("rc_plug_services");
+ if (! match)
+ return true;
+
+ list = xstrdup (match);
+ p = list;
+ while ((token = strsep (&p, " "))) {
+ bool truefalse = true;
+ if (token[0] == '!') {
+ truefalse = false;
+ token++;
+ }
+
+ star = strchr (token, '*');
+ if (star) {
+ if (strncmp (service, token, star - token) == 0) {
+ allow = truefalse;
+ break;
+ }
+ } else {
+ if (strcmp (service, token) == 0) {
+ allow = truefalse;
+ break;
+ }
+ }
+ }
+
+ free (list);
+ return (allow);
+}