From 98ffd29fab2ef14be2c2b4748c62d5e8fd1631f7 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 25 Aug 2021 08:51:56 +0000 Subject: Validate command argument types (string or command list) and give more useful error messages. --- usr.bin/tmux/tmux.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'usr.bin/tmux/tmux.h') diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index fa9fe2de72f..a7e266091df 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1136 2021/08/25 07:09:30 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1137 2021/08/25 08:51:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1378,8 +1378,16 @@ struct args_value { struct args_entry; RB_HEAD(args_tree, args_entry); +/* Arguments parsing type. */ +enum args_parse_type { + ARGS_PARSE_INVALID, + ARGS_PARSE_STRING, + ARGS_PARSE_COMMANDS_OR_STRING, + ARGS_PARSE_COMMANDS +}; + /* Arguments parsing state. */ -typedef enum args_type (*args_parse_cb)(struct args *, u_int); +typedef enum args_parse_type (*args_parse_cb)(struct args *, u_int, char **); struct args_parse { const char *template; int lower; @@ -2201,7 +2209,7 @@ int tty_keys_next(struct tty *); void args_set(struct args *, u_char, struct args_value *); struct args *args_create(void); struct args *args_parse(const struct args_parse *, struct args_value *, - u_int); + u_int, char **); void args_vector(struct args *, int *, char ***); void args_free_value(struct args_value *); void args_free(struct args *); -- cgit v1.2.3