summaryrefslogtreecommitdiffstats
path: root/cmd-set-option.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-14 06:43:33 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-14 06:43:33 +0000
commit097b96ea44d5a09ac1f3553f1789ef6e932a9eba (patch)
tree73b9da430bb07a47de4a95690427bc14768eb61a /cmd-set-option.c
parent5ccd0025a0867c9f5d9f173537c8336c7492bc8e (diff)
Having fixed flags for single-character getopt options is a bit hard to
maintain and is only going to get worse as more are used. So instead, add a new uint64_t member to cmd_entry which is a bitmask of upper and lowercase options accepted by the command. This means new single character options can be used without the need to add it explicitly to the list.
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r--cmd-set-option.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 8ef39ffe..094bf525 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.65 2009-07-12 17:07:58 nicm Exp $ */
+/* $Id: cmd-set-option.c,v 1.66 2009-07-14 06:43:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -32,7 +32,7 @@ int cmd_set_option_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_set_option_entry = {
"set-option", "set",
CMD_OPTION_SESSION_USAGE,
- CMD_GFLAG|CMD_UFLAG,
+ 0, CMD_CHFLAG('g')|CMD_CHFLAG('u'),
NULL,
cmd_option_parse,
cmd_set_option_exec,
@@ -87,7 +87,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
const struct set_option_entry *entry;
u_int i;
- if (data->flags & CMD_GFLAG)
+ if (data->chflags & CMD_CHFLAG('g'))
oo = &global_s_options;
else {
if ((s = cmd_find_session(ctx, data->target)) == NULL)
@@ -120,8 +120,8 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
- if (data->flags & CMD_UFLAG) {
- if (data->flags & CMD_GFLAG) {
+ if (data->chflags & CMD_CHFLAG('u')) {
+ if (data->chflags & CMD_CHFLAG('g')) {
ctx->error(ctx,
"can't unset global option: %s", entry->name);
return (-1);