aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2013-03-05 14:22:47 +0100
committerGravatar Steven Schubiger <stsc@refcnt.org> 2013-03-05 14:22:47 +0100
commit4dba2dcbb819bce7c5dc96c6fbead3477831269c (patch)
treecae8a73628309cf760dcb9e239a227731e0ed455
parent0d37e617babbfc634e01ffabf16e56ba152b2c49 (diff)
downloadcolorize-4dba2dcbb819bce7c5dc96c6fbead3477831269c.tar.gz
colorize-4dba2dcbb819bce7c5dc96c6fbead3477831269c.tar.bz2
Reduce short options code
-rw-r--r--colorize.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/colorize.c b/colorize.c
index b900a98..c2d31de 100644
--- a/colorize.c
+++ b/colorize.c
@@ -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);