README.md edited online with Bitbucket
[gdash.git] / include / files2c.sh
blobc762b74aed46176e6f6b684ed9d7a24b0462f9db
1 #!/bin/sh
2 filename=$1
3 shift
4 prefix=$1
5 shift
7 echo "// AUTOMATICALLY GENERATED FILE" >$filename
9 for a in $*; do
10 buf=$(echo $a|cut -f 1 -d '.')
11 name=$(echo $buf|sed "s/_/ /g")
12 echo "// GENERATED FROM $a" >>$filename
13 ./file2c $a "static unsigned char const "$buf"[]={" "};" >>$filename
14 echo >>$filename
15 names="$names \"$name\","
16 bufs="$bufs $buf,"
17 done
19 if test -n "$prefix"; then
20 echo "static unsigned char const *"$prefix"_pointers[]={$bufs NULL};" >>$filename
21 echo "static char const *"$prefix"_names[]={$names NULL};" >>$filename
23 echo >>$filename