Provide od+sed replacement for the bin2char helper
[openocd.git] / src / helper / bin2char.sh
1 #!/bin/sh
2
3 [ $# = 0 ] && {
4 echo "Usage: $0 <varname>"
5 echo
6 echo "Read binary data from standard input and write it as a C character"
7 echo "array <varname> to standard output. Add a final NULL for terminating."
8 exit 1
9 }
10
11 echo "/* Autogenerated with $0 */"
12 echo "unsigned const char $1[] = {"
13 od -v -A n -t x1 | sed 's/ *\(..\) */0x\1,/g'
14 echo "0 /* NULL-terminated */ };"