Fix some problems with the bin2char utility
[openocd.git] / src / helper / bin2char.sh
1 #!/bin/sh
2
3 [ $# != 0 ] && {
4 echo "Usage: $0"
5 echo
6 echo "Read binary data from standard input and write it as a comma separated"
7 echo "list of hexadecimal byte values to standard ouput. The output is usable"
8 echo "as a C array initializer. It is terminated with a comma so it can be"
9 echo "continued e.g. for zero termination."
10 exit 1
11 }
12
13 echo "/* Autogenerated with $0 */"
14 od -v -A n -t x1 | sed 's/ *\(..\) */0x\1,/g'