From: Sergey Matveev Date: Thu, 16 Jan 2025 08:05:30 +0000 (+0300) Subject: Rename to shorter understandable names X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ecab36d5f5a3039e7e7b3e6faa37f55aae3a92af005395c9c8696bd877ec39ed;p=keks.git Rename to shorter understandable names --- diff --git a/c/cmd/clean b/c/cmd/clean index d6a670f..ca5d904 100755 --- a/c/cmd/clean +++ b/c/cmd/clean @@ -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 index 0000000..e150e15 --- /dev/null +++ b/c/cmd/deatomiser/.gitignore @@ -0,0 +1 @@ +/deatomiser diff --git a/c/cmd/deatomiser/all.do b/c/cmd/deatomiser/all.do new file mode 100644 index 0000000..77c9dbb --- /dev/null +++ b/c/cmd/deatomiser/all.do @@ -0,0 +1 @@ +redo-ifchange deatomiser diff --git a/c/cmd/print-items/clean b/c/cmd/deatomiser/clean similarity index 69% rename from c/cmd/print-items/clean rename to c/cmd/deatomiser/clean index c118974..743c403 100755 --- a/c/cmd/print-items/clean +++ b/c/cmd/deatomiser/clean @@ -1,4 +1,4 @@ #!/bin/sh -e cd "$(dirname "$(realpath -- "$0")")" -exec rm -f print-items +exec rm -f deatomiser diff --git a/c/cmd/print-itered/print-itered.c b/c/cmd/deatomiser/deatomiser.c similarity index 84% rename from c/cmd/print-itered/print-itered.c rename to c/cmd/deatomiser/deatomiser.c index 3954f56..118ce4a 100644 --- a/c/cmd/print-itered/print-itered.c +++ b/c/cmd/deatomiser/deatomiser.c @@ -25,13 +25,11 @@ #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/print-itered/print-itered.do b/c/cmd/deatomiser/deatomiser.do similarity index 100% rename from c/cmd/print-itered/print-itered.do rename to c/cmd/deatomiser/deatomiser.do diff --git a/c/cmd/pp/.gitignore b/c/cmd/pp/.gitignore new file mode 100644 index 0000000..22710e9 --- /dev/null +++ b/c/cmd/pp/.gitignore @@ -0,0 +1 @@ +/pp diff --git a/c/cmd/pp/all.do b/c/cmd/pp/all.do new file mode 100644 index 0000000..cc4f994 --- /dev/null +++ b/c/cmd/pp/all.do @@ -0,0 +1 @@ +redo-ifchange pp diff --git a/c/cmd/print-itered/clean b/c/cmd/pp/clean similarity index 68% rename from c/cmd/print-itered/clean rename to c/cmd/pp/clean index b06b132..a2e58e7 100755 --- a/c/cmd/print-itered/clean +++ b/c/cmd/pp/clean @@ -1,4 +1,4 @@ #!/bin/sh -e cd "$(dirname "$(realpath -- "$0")")" -exec rm -f print-itered +exec rm -f pp diff --git a/c/cmd/print-items/print-items.c b/c/cmd/pp/pp.c similarity index 99% rename from c/cmd/print-items/print-items.c rename to c/cmd/pp/pp.c index 379ae23..e27db41 100644 --- a/c/cmd/print-items/print-items.c +++ b/c/cmd/pp/pp.c @@ -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/print-items.do b/c/cmd/pp/pp.do similarity index 100% rename from c/cmd/print-items/print-items.do rename to c/cmd/pp/pp.do diff --git a/c/cmd/print-items/.gitignore b/c/cmd/print-items/.gitignore deleted file mode 100644 index 043dac5..0000000 --- a/c/cmd/print-items/.gitignore +++ /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 index a28095f..0000000 --- a/c/cmd/print-items/all.do +++ /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 index e918769..0000000 --- a/c/cmd/print-itered/.gitignore +++ /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 index ec62894..0000000 --- a/c/cmd/print-itered/all.do +++ /dev/null @@ -1 +0,0 @@ -redo-ifchange print-itered diff --git a/c/doc/cmd.texi b/c/doc/cmd.texi index a6f4fbe..e1bc250 100644 --- a/c/doc/cmd.texi +++ b/c/doc/cmd.texi @@ -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 diff --git a/go/cmd/print/colour.go b/go/cmd/pp/colour.go similarity index 100% rename from go/cmd/print/colour.go rename to go/cmd/pp/colour.go diff --git a/go/cmd/print/main.go b/go/cmd/pp/main.go similarity index 97% rename from go/cmd/print/main.go rename to go/cmd/pp/main.go index 9890008..197232f 100644 --- a/go/cmd/print/main.go +++ b/go/cmd/pp/main.go @@ -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: