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
--- /dev/null
+/deatomiser
--- /dev/null
+redo-ifchange deatomiser
#!/bin/sh -e
cd "$(dirname "$(realpath -- "$0")")"
-exec rm -f print-items
+exec rm -f deatomiser
#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;
}
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;
}
--- /dev/null
+redo-ifchange pp
#!/bin/sh -e
cd "$(dirname "$(realpath -- "$0")")"
-exec rm -f print-itered
+exec rm -f pp
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"
+++ /dev/null
-/print-items
+++ /dev/null
-redo-ifchange print-items
+++ /dev/null
-/print-itered
+++ /dev/null
-redo-ifchange print-itered
@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
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) {
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: