www.nico.schottelius.org/software/cinit/browse_source/cinit-0.0.5/bin/cinit.mkheader
Nico Schottelius 423ba10303 import cinit from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-09-16 12:53:45 +02:00

20 lines
478 B
Bash

#!/bin/sh
# Nico Schottelius
# cinit: create header file
#
CONFS=$($(dirname $0)/cinit.get-confdir)/../conf/*
echo "/* Warning: Autogenerated by $0, do not edit. */"
for conf in $CONFS; do
NAME="$(basename $conf | tr a-z A-Z)"
value=$(head -n 1 $conf)
# check if numeric - no I didn't see an easier way
numeric=$(echo $value | awk '/^((0[xX])[0-9a-fA-F]+)|([0-9]+)$/ { print }')
[ "$numeric" ] || value="\"$value\""
echo "#define" "$NAME" "$value"
done