15 lines
391 B
Bash
Executable File
15 lines
391 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ $# = 0 ] && {
|
|
echo "Usage: $0 <varname>"
|
|
echo
|
|
echo "Read binary data from standard input and write it as a C character"
|
|
echo "array <varname> to standard output. Add a final NULL for terminating."
|
|
exit 1
|
|
}
|
|
|
|
echo "/* Autogenerated with $0 */"
|
|
echo "unsigned const char $1[] = {"
|
|
od -v -A n -t x1 | sed 's/ *\(..\) */0x\1,/g'
|
|
echo "0 /* NULL-terminated */ };"
|