diff options
author | Denys Vlasenko | 2013-07-30 11:41:58 +0200 |
---|---|---|
committer | Denys Vlasenko | 2013-07-30 11:41:58 +0200 |
commit | bfa6ed1bf43ea607e33a6e89a0ef03f84a5b5d38 (patch) | |
tree | 7d83bd734ff714fd4c940685d82aa3015ccc4135 /coreutils/catv.c | |
parent | 79c618c41193eaaa092cb977f06fc112155ba92b (diff) | |
download | busybox-bfa6ed1bf43ea607e33a6e89a0ef03f84a5b5d38.zip busybox-bfa6ed1bf43ea607e33a6e89a0ef03f84a5b5d38.tar.gz |
catv: code shrink
catv_main 250 227 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/catv.c')
-rw-r--r-- | coreutils/catv.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/coreutils/catv.c b/coreutils/catv.c index 18b1810..0139b39 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c @@ -26,19 +26,22 @@ int catv_main(int argc UNUSED_PARAM, char **argv) int retval = EXIT_SUCCESS; int fd; unsigned opts; - int flags = 0; - - opts = getopt32(argv, "etv"); #define CATV_OPT_e (1<<0) #define CATV_OPT_t (1<<1) #define CATV_OPT_v (1<<2) + typedef char BUG_const_mismatch[ + CATV_OPT_e == VISIBLE_ENDLINE && CATV_OPT_t == VISIBLE_SHOW_TABS + ? 1 : -1 + ]; + + opts = getopt32(argv, "etv"); argv += optind; - if (opts & (CATV_OPT_e | CATV_OPT_t)) - opts &= ~CATV_OPT_v; +#if 0 /* These consts match, we can just pass "opts" to visible() */ if (opts & CATV_OPT_e) flags |= VISIBLE_ENDLINE; if (opts & CATV_OPT_t) flags |= VISIBLE_SHOW_TABS; +#endif /* Read from stdin if there's nothing else to do. */ if (!argv[0]) @@ -64,7 +67,7 @@ int catv_main(int argc UNUSED_PARAM, char **argv) putchar(c); } else { char buf[sizeof("M-^c")]; - visible(c, buf, flags); + visible(c, buf, opts); fputs(buf, stdout); } } |