diff options
author | Steven Schubiger <stsc@refcnt.org> | 2013-03-05 14:22:47 +0100 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2013-03-05 14:22:47 +0100 |
commit | 4dba2dcbb819bce7c5dc96c6fbead3477831269c (patch) | |
tree | cae8a73628309cf760dcb9e239a227731e0ed455 /colorize.c | |
parent | 0d37e617babbfc634e01ffabf16e56ba152b2c49 (diff) | |
download | colorize-4dba2dcbb819bce7c5dc96c6fbead3477831269c.tar.gz colorize-4dba2dcbb819bce7c5dc96c6fbead3477831269c.tar.bz2 |
Reduce short options code
Diffstat (limited to 'colorize.c')
-rw-r--r-- | colorize.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -205,6 +205,11 @@ static void vfprintf_fail (const char *, ...); static void stack_var (void ***, unsigned int *, unsigned int, void *); static void release_var (void **, unsigned int, void **); +#define SET_OPT_TYPE(type) \ + opt_type = type; \ + opt = 0; \ + goto PARSE_OPT; \ + extern char *optarg; extern int optind; @@ -277,13 +282,9 @@ main (int argc, char **argv) } break; case 'h': - opt_type = OPT_HELP; - opt = 0; - goto PARSE_OPT; + SET_OPT_TYPE (OPT_HELP); case 'v': - opt_type = OPT_VERSION; - opt = 0; - goto PARSE_OPT; + SET_OPT_TYPE (OPT_VERSION); case '?': print_help (); exit (EXIT_FAILURE); |