From 000dd684722d34b06ab1d77c826af7e4922d40ee Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 10 Sep 2021 18:03:52 +0200 Subject: Add num2text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- numtext.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'numtext.c') diff --git a/numtext.c b/numtext.c index 3b78756..18d6c2c 100644 --- a/numtext.c +++ b/numtext.c @@ -20,6 +20,8 @@ main(int argc, char *argv[]) return numtext_strip_main(argc, argv); else if (!strcmp(argv0, "card2ord")) return card2ord_main(argc, argv); + else if (!strcmp(argv0, "num2text")) + return num2text_main(argc, argv); fprintf(stderr, "%s: not a recognised command for numtext multicall binary\n", argv[0]); return 1; @@ -145,6 +147,7 @@ get_language(const char *arg, enum libnumtext_language *langp, int *have_langp) static char * process_option(char *opt, struct option *options, uint32_t *flagsp, uint32_t *maskedp) { + uint32_t flag, mask; size_t len; if (opt[0] == '?' && (!opt[1] || opt[1] == ',')) { @@ -158,12 +161,14 @@ process_option(char *opt, struct option *options, uint32_t *flagsp, uint32_t *ma for (; options->option; options++) { len = strlen(options->option); if (!strncmp(opt, options->option, len) && (!opt[len] || opt[len] == ',')) { - if (options->mask & *maskedp) { + flag = options->flag; + mask = options->mask ? options->mask : options->flag; + if ((mask & *maskedp) && (*flagsp & mask) != flag) { fprintf(stderr, "%s: option conflicts with previously specified option: %.*s\n", argv0, (int)len, opt); exit(1); } - *flagsp |= options->flag; - *maskedp |= options->mask; + *flagsp |= flag; + *maskedp |= mask; return &opt[len]; } } -- cgit v1.2.3-70-g09d2