summaryrefslogtreecommitdiffstats
path: root/src/genembedc
blob: 81545cd86b428b59583119520743dee50644d7a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e

: ${TOOL_CAT:=cat}
: ${TOOL_SED:=sed}
CONF=${1:-dhcpcd-definitions.conf}
CONF_SMALL=${2:-dhcpcd-definitions.conf}
C=${3:-dhcpcd-embedded.c.in}

$TOOL_CAT $C
echo "#ifdef SMALL"
$TOOL_SED \
	-e 's/#.*$//' \
	-e '/^$/d' \
	-e 's/^/"/g' \
	-e 's/$/\\n\"/g' \
	-e 's/ [ ]*/ /g' \
	-e 's/	[	]*/ /g' \
	$CONF_SMALL
echo "#else"
$TOOL_SED \
	-e 's/#.*$//' \
	-e '/^$/d' \
	-e 's/^/"/g' \
	-e 's/$/\\n"/g' \
	-e 's/ [ ]*/ /g' \
	-e 's/	[	]*/ /g' \
	$CONF
echo "#endif"
printf "%s\n%s\n" '"\0";'