aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/config.c b/src/config.c
index 53d757d..f42c408 100644
--- a/src/config.c
+++ b/src/config.c
@@ -269,18 +269,26 @@ cb_match_list(enum grecs_callback_command cmd, grecs_node_t *node,
static void
value_to_options(grecs_value_t *val, int *options)
{
- if (strcmp(val->v.string, "nowait") == 0)
- *options |= OPT_NOWAIT;
- else if (strcmp(val->v.string, "wait") == 0)
- *options &= ~OPT_NOWAIT;
- else if (strcmp(val->v.string, "stdout") == 0)
- *options |= OPT_STDOUT;
- else if (strcmp(val->v.string, "stderr") == 0)
- *options |= OPT_STDERR;
- else if (strcmp(val->v.string, "nullin") == 0)
- *options |= OPT_NULLIN;
- else
+#define NEGATE 0x8000
+ static struct transtab opttab[] = {
+ { "nowait", OPT_NOWAIT },
+ { "wait", NEGATE | OPT_NOWAIT },
+ { "stdout", OPT_STDOUT },
+ { "stderr", OPT_STDERR },
+ { "nullin", OPT_NULLIN },
+ { "shell", OPT_SHELL },
+ { NULL }
+ };
+ int t;
+
+ if (trans_strtotok(opttab, val->v.string, &t)) {
grecs_error(&val->locus, 0, "unrecognized option");
+ return;
+ }
+ if (t & NEGATE)
+ *options &= ~(t & ~NEGATE);
+ else
+ *options |= t;
}
static int

Return to:

Send suggestions and report system problems to the System administrator.