From b6c2a0d45d4165dfd326bd7a28e66d9cedb8ae84 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 23 Mar 2014 16:04:36 -0700 Subject: parse-options: make sure argh string does not have SP or _ We encourage to spell an argument hint that consists of multiple words as a single-token separated with dashes. In order to help catching violations added by new callers of parse-options, make sure argh does not contain SP or _ when the code validates the option definitions. Signed-off-by: Junio C Hamano --- parse-options.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'parse-options.c') diff --git a/parse-options.c b/parse-options.c index a5fa0b893..c81d3a065 100644 --- a/parse-options.c +++ b/parse-options.c @@ -375,6 +375,9 @@ static void parse_options_check(const struct option *opts) default: ; /* ok. (usually accepts an argument) */ } + if (opts->argh && + strcspn(opts->argh, " _") != strlen(opts->argh)) + err |= optbug(opts, "multi-word argh should use dash to separate words"); } if (err) exit(128); -- cgit v1.2.1