summaryrefslogtreecommitdiffstats
path: root/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-13 23:11:35 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-13 23:11:35 +0000
commit5f108d9df6bada119def52518152a487f8695702 (patch)
tree2ae6420cfdea4f68ce031e9a1ed62c2756c2c588 /tmux.h
parent5d91555c7c8d88577892e0a2e2bde2cde60a2882 (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 'tmux.h')
-rw-r--r--tmux.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/tmux.h b/tmux.h
index 585daeb9..bd4cbf9a 100644
--- a/tmux.h
+++ b/tmux.h
@@ -861,17 +861,13 @@ struct cmd_entry {
#define CMD_CANTNEST 0x2
#define CMD_ARG1 0x4
#define CMD_ARG01 0x8
-#define CMD_AFLAG 0x10
-#define CMD_DFLAG 0x20
-#define CMD_GFLAG 0x40
-#define CMD_KFLAG 0x80
-#define CMD_UFLAG 0x100
-#define CMD_BIGDFLAG 0x200
-#define CMD_BIGUFLAG 0x400
-#define CMD_RFLAG 0x800
-
int flags;
+#define CMD_CHFLAG(flag) \
+ ((flag) >= 'a' && (flag) <= 'z' ? 1ULL << ((flag) - 'a') : \
+ (flag) >= 'A' && (flag) <= 'Z' ? 1ULL << (26 + (flag) - 'A') : 0)
+ uint64_t chflags;
+
void (*init)(struct cmd *, int);
int (*parse)(struct cmd *, int, char **, char **);
int (*exec)(struct cmd *, struct cmd_ctx *);
@@ -883,34 +879,34 @@ struct cmd_entry {
/* Generic command data. */
struct cmd_target_data {
- int flags;
+ uint64_t chflags;
char *target;
char *arg;
};
struct cmd_srcdst_data {
- int flags;
+ uint64_t chflags;
char *src;
char *dst;
char *arg;
};
struct cmd_buffer_data {
- int flags;
+ uint64_t chflags;
char *target;
int buffer;
char *arg;
};
struct cmd_option_data {
- int flags;
+ uint64_t chflags;
char *target;
char *option;
char *value;
};
struct cmd_pane_data {
- int flags;
+ uint64_t chflags;
char *target;
char *arg;
int pane;