finish cleanup

This commit is contained in:
2025-03-19 22:04:23 +02:00
parent 2194b33af7
commit 1cd14ad69f
11 changed files with 1745 additions and 0 deletions

30
3rd/str/tools/file-to-str Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
die() {
echo >&2 "$@"
exit 1
}
[ $# -eq 2 ] || die "Usage: $(basename "$0") FILE VAR-NAME"
[ -f "$1" ] || die "$0: file \"$1\" does not exist, or is not a file."
set -e
cat << EOF
// AUTOMATICALLY GENERATED FILE - DO NOT EDIT
// source file: $1
#include "str.h"
static
const char _bytes[] = {
EOF
od -v -w12 -A n -t x1 "$1" | sed -E 's/\<([[:xdigit:]]{2})\>/0x\1,/g'
cat << EOF
0x00 };
const str $2 = (const str){ _bytes, _ref_info(sizeof(_bytes) - 1) };
EOF