aboutsummaryrefslogtreecommitdiff
path: root/src/helper/bin2char.sh
blob: 85a0fd6a88546cd61d33683f53a22d55568cb8ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

[ $# != 0 ] && {
    echo "Usage: $0"
    echo
    echo "Read binary data from standard input and write it as a comma separated"
    echo "list of hexadecimal byte values to standard ouput. The output is usable"
    echo "as a C array initializer. It is terminated with a comma so it can be"
    echo "continued e.g. for zero termination."
    exit 1
}

echo "/* Autogenerated with $0 */"
od -v -A n -t x1 | sed 's/ *\(..\) */0x\1,/g'