]> Cypherpunks repositories - keks.git/commitdiff
Rename to shorter understandable names
authorSergey Matveev <stargrave@stargrave.org>
Thu, 16 Jan 2025 08:05:30 +0000 (11:05 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 16 Jan 2025 09:34:27 +0000 (12:34 +0300)
18 files changed:
c/cmd/clean
c/cmd/deatomiser/.gitignore [new file with mode: 0644]
c/cmd/deatomiser/all.do [new file with mode: 0644]
c/cmd/deatomiser/clean [moved from c/cmd/print-items/clean with 69% similarity]
c/cmd/deatomiser/deatomiser.c [moved from c/cmd/print-itered/print-itered.c with 84% similarity]
c/cmd/deatomiser/deatomiser.do [moved from c/cmd/print-itered/print-itered.do with 100% similarity]
c/cmd/pp/.gitignore [new file with mode: 0644]
c/cmd/pp/all.do [new file with mode: 0644]
c/cmd/pp/clean [moved from c/cmd/print-itered/clean with 68% similarity]
c/cmd/pp/pp.c [moved from c/cmd/print-items/print-items.c with 99% similarity]
c/cmd/pp/pp.do [moved from c/cmd/print-items/print-items.do with 100% similarity]
c/cmd/print-items/.gitignore [deleted file]
c/cmd/print-items/all.do [deleted file]
c/cmd/print-itered/.gitignore [deleted file]
c/cmd/print-itered/all.do [deleted file]
c/doc/cmd.texi
go/cmd/pp/colour.go [moved from go/cmd/print/colour.go with 100% similarity]
go/cmd/pp/main.go [moved from go/cmd/print/main.go with 97% similarity]

index d6a670f3c29852e3e28b2241441588d63d51e98e6ac834bbda503b1a0ff8d76e..ca5d9043788589ce1c42ef86cde23a5494f10554e626ebd8b101187a881b84f4 100755 (executable)
@@ -2,8 +2,8 @@
 
 cd "$(dirname "$(realpath -- "$0")")"
 cer-verify/clean
+deatomiser/clean
 for-fuzz/clean
 lib/clean
-print-items/clean
-print-itered/clean
+pp/clean
 test-vector/clean
diff --git a/c/cmd/deatomiser/.gitignore b/c/cmd/deatomiser/.gitignore
new file mode 100644 (file)
index 0000000..e150e15
--- /dev/null
@@ -0,0 +1 @@
+/deatomiser
diff --git a/c/cmd/deatomiser/all.do b/c/cmd/deatomiser/all.do
new file mode 100644 (file)
index 0000000..77c9dbb
--- /dev/null
@@ -0,0 +1 @@
+redo-ifchange deatomiser
similarity index 69%
rename from c/cmd/print-items/clean
rename to c/cmd/deatomiser/clean
index c11897405b7adfea266068600282211bdb3c82a7c793e5d4d4dd90fc0b01068f..743c403753928134a180041f12f6efbe675117fd2a369dbe9ef753b082441dce 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh -e
 
 cd "$(dirname "$(realpath -- "$0")")"
-exec rm -f print-items
+exec rm -f deatomiser
similarity index 84%
rename from c/cmd/print-itered/print-itered.c
rename to c/cmd/deatomiser/deatomiser.c
index 3954f5666255d223b0d19ba5ec4373fe0db1d60cef69087afbf36889477e4089..118ce4a00b3a3d4bfc87c1edf935576d31d045bd851a6520a3f7c0461d8ae2f7 100644 (file)
 #include "../lib/printai.h"
 #include "../lib/uuid.h"
 
-static const size_t maxStrLen = 40;
-
 int
 main(int argc, char **argv)
 {
     if (argc < 2) {
-        fprintf(stderr, "Usage: %s FILE\n", argv[0]);
+        fputs("Usage: deatomiser FILE\n", stderr);
         return EXIT_FAILURE;
     }
     size_t len = 0;
@@ -108,22 +106,14 @@ main(int argc, char **argv)
             }
             break;
         case KEKSItemBin: {
-            const size_t l = (atom.v.str.len > maxStrLen) ? maxStrLen : atom.v.str.len;
-            hex = HexEnc(atom.v.str.ptr, l);
-            fprintf(
-                stdout,
-                "%zu:%s%s\n",
-                atom.v.str.len,
-                hex,
-                (atom.v.str.len > maxStrLen) ? "..." : "");
+            hex = HexEnc(atom.v.str.ptr, atom.v.str.len);
+            fprintf(stdout, "%zu:%s\n", atom.v.str.len, hex);
             free(hex);
             break;
         }
         case KEKSItemStr: {
-            const size_t l = (atom.v.str.len > maxStrLen) ? maxStrLen : atom.v.str.len;
-            hex = strndup((const char *)(atom.v.str.ptr), l);
-            fprintf(
-                stdout, "\"%s%s\"\n", hex, (atom.v.str.len > maxStrLen) ? "..." : "");
+            hex = strndup((const char *)(atom.v.str.ptr), atom.v.str.len);
+            fprintf(stdout, "\"%s\"\n", hex);
             free(hex);
             break;
         }
diff --git a/c/cmd/pp/.gitignore b/c/cmd/pp/.gitignore
new file mode 100644 (file)
index 0000000..22710e9
--- /dev/null
@@ -0,0 +1 @@
+/pp
diff --git a/c/cmd/pp/all.do b/c/cmd/pp/all.do
new file mode 100644 (file)
index 0000000..cc4f994
--- /dev/null
@@ -0,0 +1 @@
+redo-ifchange pp
similarity index 68%
rename from c/cmd/print-itered/clean
rename to c/cmd/pp/clean
index b06b1326e3956e06ab3e5dd7a560f8a5efbc9d6449172113ad8ba49099bfe78b..a2e58e74575bc67f23ba49cc92c0241a070647539cc49e358300a6f1605c1d1f 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh -e
 
 cd "$(dirname "$(realpath -- "$0")")"
-exec rm -f print-itered
+exec rm -f pp
similarity index 99%
rename from c/cmd/print-items/print-items.c
rename to c/cmd/pp/pp.c
index 379ae2317685fedb0e88ce3b2845cf57506bfbf12cb9bc59fd4705adb93751db..e27db4115ee5c6e978da37e31c1bf5d115651108c6aa058da7e1296819e13e7d 100644 (file)
@@ -59,7 +59,7 @@ static void
 usage(void)
 {
     fputs(
-        "Usage: print-items [OPTIONS] FILE\n"
+        "Usage: pp [OPTIONS] FILE\n"
         "  --max-str-len X -- limit output of strings to X (40 by default)\n"
         "  --do-encode     -- encode the data after decoding, just to test\n"
         "  --no-offsets    -- do not print offsets\n"
diff --git a/c/cmd/print-items/.gitignore b/c/cmd/print-items/.gitignore
deleted file mode 100644 (file)
index 043dac5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/print-items
diff --git a/c/cmd/print-items/all.do b/c/cmd/print-items/all.do
deleted file mode 100644 (file)
index a28095f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-redo-ifchange print-items
diff --git a/c/cmd/print-itered/.gitignore b/c/cmd/print-itered/.gitignore
deleted file mode 100644 (file)
index e918769..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/print-itered
diff --git a/c/cmd/print-itered/all.do b/c/cmd/print-itered/all.do
deleted file mode 100644 (file)
index ec62894..0000000
+++ /dev/null
@@ -1 +0,0 @@
-redo-ifchange print-itered
index a6f4fbe52946882a0d931328bac369f8883e908af8440686d0c7ee01236a2fd1..e1bc2504a7027152af4bdc757c1a017aef107a169c63faf8cf0e89193757dfd9 100644 (file)
@@ -6,15 +6,15 @@
 @pindex cmd/test-vector
 @item cmd/test-vector
 Example program that forms the same test vector as
-@file{tkeks/test-vector.tcl} in a streaming way.
+@file{tcl/test-vector.tcl} in a streaming way.
 
-@pindex cmd/print-itered
-@item cmd/print-itered
+@pindex cmd/deatomiser
+@item cmd/deatomiser
 Example program that decodes the provided file with iterated
 functions, that uses pretty printer as a callback.
 
-@pindex cmd/print-items
-@item cmd/test-items
+@pindex cmd/pp
+@item cmd/pp
 Example program that decodes the provided file into @ref{Items, items}
 and pretty prints it. It respects @env{$NO_COLOR} environment variable.
 If @env{$DO_ENCODE} is specified, then it encodes the decoded items into
similarity index 100%
rename from go/cmd/print/colour.go
rename to go/cmd/pp/colour.go
similarity index 97%
rename from go/cmd/print/main.go
rename to go/cmd/pp/main.go
index 989000855b87ab1f15bf20789141e71552b7f4a91ef5240e228564d46e0d1282..197232f5ab2c9721cd35706920e09de717d6449c69b7e1feaf190e332c5344f7 100644 (file)
@@ -48,7 +48,7 @@ func printbin(s []byte) {
                s = s[:int(*MaxStrLen)]
                dots = "..."
        }
-       fmt.Printf("%s%d%s:%s%s\n", Magenta, sLen, Reset, hexenc(s), dots)
+       fmt.Printf("%s%d:%s%s%s\n", Magenta, sLen, Reset, hexenc(s), dots)
 }
 
 func printer(iter *keks.Iterator, count int, inList, inMap bool) {
@@ -70,7 +70,7 @@ func printer(iter *keks.Iterator, count int, inList, inMap bool) {
                if inList {
                        fmt.Printf("%s%d:%s ", Yellow, i, Reset)
                } else if inMap {
-                       fmt.Printf("%s%s%s: ", Green, key, Reset)
+                       fmt.Printf("%s%s:%s ", Green, key, Reset)
                }
                switch iter.T {
                case types.List: