From 29358591f48f23e0a71c52dc13c9c1f453235ca4 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 12 Sep 2016 15:02:22 -0400 Subject: Add -g option to xx --- .bin/xx.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.bin/xx.c b/.bin/xx.c index 153ba74e..3aac12f6 100755 --- a/.bin/xx.c +++ b/.bin/xx.c @@ -10,12 +10,15 @@ exec cc -Weverything -Wno-vla -o ~/.bin/xx $0 int main(int argc, char **argv) { size_t cols = 16; + size_t group = 8; char *path = NULL; - while (getopt(argc, argv, "c:") > 0) + while (getopt(argc, argv, "c:g:") > 0) if (optopt == 'c') { cols = (size_t) strtol(optarg, NULL, 10); if (!cols) return EXIT_FAILURE; + } else if (optopt == 'g') { + group = (size_t) strtol(optarg, NULL, 10); } else return EXIT_FAILURE; if (argc > optind) path = argv[optind]; @@ -29,8 +32,12 @@ int main(int argc, char **argv) uint8_t buf[cols]; for (;;) { size_t n = fread(buf, 1, sizeof(buf), file); - for (size_t i = 0; i < n; ++i) + + for (size_t i = 0; i < n; ++i) { + if (group && i && !(i % group)) printf(" "); printf("%02x ", buf[i]); + } + printf("\n"); if (n < sizeof(buf)) break; } -- cgit 1.4.1 mit/home/.config/git/ignore?id=14a6f74aa692bd8db3d88bbf68b6b22c7a5317d1&follow=1'>commit diff
path: root/home/.config/git/ignore (unfollow)
Commit message (Collapse)Author
2020-03-03Don't use $ inside $(())June McEnroe
2020-03-03Remove setoptJune McEnroe
2020-03-03Use getopts in shell scriptsJune McEnroe
WTF why did no one tell me about this?
2020-02-27Style %T outside of Rs in italicJune McEnroe
2020-02-26Add Fierce Femmes and Notorious LiarsJune McEnroe
2020-02-23Add This Is How You Lose the Time WarJune McEnroe
2020-02-22Add See Ya LaterJune McEnroe
2020-02-20Remove wiki scriptJune McEnroe
Wikipedia seems to have removed the one-sentence extracts from the opensearch results. Too bad. It's not a wiki script, what we need is a command that fetches single-sentence summaries of articles on Wikipedia.
2020-02-19Add The Obelisk GateJune McEnroe
2020-02-17Add Four Tet — HandsJune McEnroe
One from the cafe that caught my attention.
2020-02-12Simplify macOS notify-sendJune McEnroe
2020-02-12Add imbox and notemap to pageJune McEnroe
2020-02-12Collapse simple linksJune McEnroe
2020-02-12Move catgirl up the pageJune McEnroe
2020-02-12Update catgirl pty grabJune McEnroe
2020-02-12Link to cgit /about pages where appropriateJune McEnroe
2020-02-11Separate LINKS from BINS for html to workJune McEnroe
2020-02-11Add margin to Bl-bullet itemsJune McEnroe
2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe
2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe
Apparently sometimes it didn't like receiving its own internal storage to parse again. Understandable.
2020-02-09Add To Be Taught, If FortunateJune McEnroe
2020-02-04Add The Future of Another TimelineJune McEnroe
Wow. One of the best I've read.
2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe
Broke out LDLIBS for each bin, and made everything more uniform.
2020-01-28Change scout sensitivity to 1.4June McEnroe
idk it seems to work.
2020-01-28Import shows.txtJune McEnroe