diff options
Diffstat (limited to 'luatoc.sh')
-rwxr-xr-x | luatoc.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/luatoc.sh b/luatoc.sh new file mode 100755 index 0000000..cd6a231 --- /dev/null +++ b/luatoc.sh | |||
@@ -0,0 +1,14 @@ | |||
1 | if [ $# -ne 3 ]; then | ||
2 | echo "Usage: `basename $0` <input file> <output file> <variable name>" | ||
3 | exit 1 | ||
4 | fi | ||
5 | |||
6 | { | ||
7 | echo "extern const char $3[] = {" | ||
8 | od --format=x1 --output-duplicates $1 \ | ||
9 | | cut --delimiter=' ' --fields=2- --only-delimited \ | ||
10 | | sed -e 's/^/ /' -e 's/\>/,/g' -e 's/\</0x/g' | ||
11 | echo "};" | ||
12 | echo | ||
13 | echo "extern const unsigned int $3_size = sizeof $3;" | ||
14 | } > $2 | ||