diff --git a/lib/include/libcfg.h b/lib/include/libcfg.h index 01a014c..1d5b2a7 100644 --- a/lib/include/libcfg.h +++ b/lib/include/libcfg.h @@ -27,7 +27,7 @@ typedef struct { */ unsigned int allow_block : 1; - int (*handle)(void *obj, char *arg, rdline_t *rd, int flags); + int (*handle)(void *obj, char *arg, rdline_t *rd); } cfg_param_t; /* @@ -92,11 +92,10 @@ int pack_argv(char *str); /* Parse a configuration file containing ' [arguments...]' lines. - The cfgobj and flags are passed to the callback in the params array. + The cfgobj is passed to the callback in the params array. Returns zero on success. */ -int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count, - int flags); +int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count); #endif /* LIBCONFIG_H */ diff --git a/lib/init/rdsvc.c b/lib/init/rdsvc.c index 7d70232..7f7bc29 100644 --- a/lib/init/rdsvc.c +++ b/lib/init/rdsvc.c @@ -43,10 +43,9 @@ static int try_pack_argv(char *str, rdline_t *rd) return count; } -static int svc_desc(void *user, char *arg, rdline_t *rd, int flags) +static int svc_desc(void *user, char *arg, rdline_t *rd) { service_t *svc = user; - (void)flags; if (try_unescape(arg, rd)) return -1; @@ -54,10 +53,9 @@ static int svc_desc(void *user, char *arg, rdline_t *rd, int flags) return svc->desc == NULL ? -1 : 0; } -static int svc_tty(void *user, char *arg, rdline_t *rd, int flags) +static int svc_tty(void *user, char *arg, rdline_t *rd) { service_t *svc = user; - (void)flags; if (strncmp(arg, "truncate", 8) == 0 && isspace(arg[8])) { svc->flags |= SVC_FLAG_TRUNCATE_OUT; @@ -73,11 +71,10 @@ static int svc_tty(void *user, char *arg, rdline_t *rd, int flags) return svc->ctty == NULL ? -1 : 0; } -static int svc_exec(void *user, char *arg, rdline_t *rd, int flags) +static int svc_exec(void *user, char *arg, rdline_t *rd) { service_t *svc = user; exec_t *e, *end; - (void)flags; svc->flags |= SVC_FLAG_HAS_EXEC; @@ -104,10 +101,9 @@ static int svc_exec(void *user, char *arg, rdline_t *rd, int flags) return 0; } -static int svc_before(void *user, char *arg, rdline_t *rd, int flags) +static int svc_before(void *user, char *arg, rdline_t *rd) { service_t *svc = user; - (void)flags; if (svc->before != NULL) { fprintf(stderr, "%s: %zu: 'before' dependencies respecified\n", @@ -123,10 +119,9 @@ static int svc_before(void *user, char *arg, rdline_t *rd, int flags) return (svc->num_before < 0) ? -1 : 0; } -static int svc_after(void *user, char *arg, rdline_t *rd, int flags) +static int svc_after(void *user, char *arg, rdline_t *rd) { service_t *svc = user; - (void)flags; if (svc->after != NULL) { fprintf(stderr, "%s: %zu: 'after' dependencies respecified\n", @@ -142,11 +137,10 @@ static int svc_after(void *user, char *arg, rdline_t *rd, int flags) return (svc->num_after < 0) ? -1 : 0; } -static int svc_type(void *user, char *arg, rdline_t *rd, int flags) +static int svc_type(void *user, char *arg, rdline_t *rd) { service_t *svc = user; int count = try_pack_argv(arg, rd); - (void)flags; if (count < 1) return -1; @@ -190,11 +184,10 @@ fail_limit: return -1; } -static int svc_target(void *user, char *arg, rdline_t *rd, int flags) +static int svc_target(void *user, char *arg, rdline_t *rd) { service_t *svc = user; int target; - (void)flags; if (try_unescape(arg, rd)) return -1; @@ -253,7 +246,7 @@ service_t *rdsvc(int dirfd, const char *filename) svc->id = -1; if (rdcfg(svc, &rd, svc_params, - sizeof(svc_params) / sizeof(svc_params[0]), 0)) { + sizeof(svc_params) / sizeof(svc_params[0]))) { goto fail; } diff --git a/lib/libcfg/rdcfg.c b/lib/libcfg/rdcfg.c index d3fc947..8bcc804 100644 --- a/lib/libcfg/rdcfg.c +++ b/lib/libcfg/rdcfg.c @@ -47,8 +47,7 @@ static int splitkv(rdline_t *rd, char **k, char **v) return 0; } -int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count, - int flags) +int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count) { const cfg_param_t *p; char *key, *value; @@ -67,7 +66,7 @@ int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count, ; if (*value != '\0') { - ret = p->handle(cfgobj, value, rd, flags); + ret = p->handle(cfgobj, value, rd); if (ret) return -1; } @@ -75,7 +74,7 @@ int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count, while ((ret = rdline(rd)) == 0) { if (strcmp(rd->line, "}") == 0) break; - if (p->handle(cfgobj, rd->line, rd, flags)) + if (p->handle(cfgobj, rd->line, rd)) return -1; } @@ -83,7 +82,7 @@ int rdcfg(void *cfgobj, rdline_t *rd, const cfg_param_t *params, size_t count, return -1; if (ret > 0) goto fail_bra; - } else if (p->handle(cfgobj, value, rd, flags)) { + } else if (p->handle(cfgobj, value, rd)) { return -1; } }