dd: move suffix struct to xatonum.c
[oweals/busybox.git] / coreutils / catv.c
index 18b18104e763420725f6f6fedabe5c30bc20f890..6bb73ba63d5e8341113fafbddf5a7d0b8b13761b 100644 (file)
 
 #include "libbb.h"
 
+#define CATV_OPT_e (1<<0)
+#define CATV_OPT_t (1<<1)
+#define CATV_OPT_v (1<<2)
+struct BUG_const_mismatch {
+       char BUG_const_mismatch[
+               CATV_OPT_e == VISIBLE_ENDLINE && CATV_OPT_t == VISIBLE_SHOW_TABS
+               ? 1 : -1
+       ];
+};
+
 int catv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 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)
        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 +69,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);
                                }
                        }