From 4823b44f263149bb7fe422b58c9dbb324272faf3 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sun, 16 Jul 2017 21:16:16 -0400 Subject: Remove color from xx, group ASCII --- curtis/.bin/xx.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'curtis') diff --git a/curtis/.bin/xx.c b/curtis/.bin/xx.c index 1c77fcd5..78d8db4c 100755 --- a/curtis/.bin/xx.c +++ b/curtis/.bin/xx.c @@ -21,16 +21,11 @@ static bool allZero(const uint8_t *buf, size_t len) { enum { FLAG_ASCII = 1 << 0, - FLAG_COLOR = 1 << 1, - FLAG_OFFSET = 1 << 2, - FLAG_SKIP = 1 << 3, - FLAG_UNDUMP = 1 << 4, + FLAG_OFFSET = 1 << 1, + FLAG_SKIP = 1 << 2, + FLAG_UNDUMP = 1 << 3, }; -static void color(size_t i) { - printf("\x1b[%c%cm", (i % 8) ? '3' : '9', (char)(i % 8 + '0')); -} - static void dump(size_t cols, size_t group, uint8_t flags, FILE *file) { uint8_t buf[cols]; size_t offset = 0, len = 0; @@ -39,8 +34,6 @@ static void dump(size_t cols, size_t group, uint8_t flags, FILE *file) { len = fread(buf, 1, sizeof(buf), file); if (!len) break; - if (flags & FLAG_COLOR) printf("\x1b[39m"); - if ((flags & FLAG_SKIP) && len == sizeof(buf)) { static bool skip; if (allZero(buf, len)) { @@ -57,7 +50,6 @@ static void dump(size_t cols, size_t group, uint8_t flags, FILE *file) { for (size_t i = 0; i < len; ++i) { if (group && i && !(i % group)) printf(" "); - if (flags & FLAG_COLOR) color(i); printf("%02x ", buf[i]); } @@ -67,7 +59,7 @@ static void dump(size_t cols, size_t group, uint8_t flags, FILE *file) { } printf(" "); for (size_t i = 0; i < len; ++i) { - if (flags & FLAG_COLOR) color(i); + if (group && i && !(i % group)) printf(" "); printf("%c", isprint(buf[i]) ? buf[i] : '.'); } } @@ -93,17 +85,16 @@ int main(int argc, char *argv[]) { char *path = NULL; int opt; - while (0 < (opt = getopt(argc, argv, "aCc:fg:hku"))) { + while (0 < (opt = getopt(argc, argv, "ac:fg:hku"))) { switch (opt) { case 'a': flags ^= FLAG_ASCII; break; - case 'C': flags ^= FLAG_COLOR; break; case 'f': flags ^= FLAG_OFFSET; break; case 'k': flags ^= FLAG_SKIP; break; case 'u': flags ^= FLAG_UNDUMP; break; case 'c': cols = strtoul(optarg, NULL, 10); break; case 'g': group = strtoul(optarg, NULL, 10); break; default: - fprintf(stderr, "usage: xx [-aCfku] [-c cols] [-g group] [file]\n"); + fprintf(stderr, "usage: xx [-afku] [-c cols] [-g group] [file]\n"); return (opt == 'h') ? EX_OK : EX_USAGE; } } -- cgit 1.4.1 d>Update email addressesJune McEnroe 2020-04-23Call updateConsumer from handleError 1.2p1June McEnroe This should prevent continually crashing on the same ERROR in the pounce buffer. 2020-04-20Use . as ${LDLIBS.$@} separatorJune McEnroe 2020-04-05Error on invalid ISUPPORT values 1.2June McEnroe 2020-04-05Only set RCS on FreeBSDJune McEnroe 2020-04-05Log bans and unbansJune McEnroe 2020-04-05Parse mode types from ISUPPORTJune McEnroe 2020-04-05Add unscoop matchers for ban/unban eventsJune McEnroe The IRC and Textual matchers miss bans mixed with other mode changes, but those are rare. 2020-04-05Check unscoop regexps with make testJune McEnroe 2020-04-05Add unscoop -n flag for checking regexpsJune McEnroe 2020-04-05Add Ban and Unban event typesJune McEnroe 2020-04-02Update styleJune McEnroe Replacing declarations followed by while loops with for loops and generating the short option string from the long options. 2020-03-31Update unscoop catgirl matchersJune McEnroe I'm not concerned about keeping the old matchers since I'm almost entirely certain I was the only one who ever used the old version of catgirl, and I already imported those logs. 2020-03-31Fix writing verbose to stderrJune McEnroe 2020-03-02Include <>/-/* around nicks in scoop coloring 1.1June McEnroe 2020-03-02Replace .mk files with configure scriptJune McEnroe 2020-02-28Implement the causal.agency/consumer capabilityJune McEnroe 2020-02-22Include <>/-/* around nicks in coloringJune McEnroe 2020-02-22Use (almost) the full range of IRC colors for nicksJune McEnroe