summary refs log tree commit diff
path: root/.bin/xx.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.bin/xx.c11
1 files 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;
     }
/td>Revert "Add first working version of imbox"June McEnroe 2019-12-21Add first working version of imboxJune McEnroe 2019-12-20Respect mailmap in gl pretty formatJune McEnroe 2019-12-20Set LANG in cgit filtersJune McEnroe 2019-12-20Source .editrc before applying -v or -eJune McEnroe 2019-12-20Disable signing commitsJune McEnroe 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe 2019-12-16Post "cgit setup"June McEnroe