summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/lynx/cfg_defs.sh
blob: b0a51b4e825ac6ee8c8cb1de68fcacc9847583f7 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Translate the lynx_cfg.h and config.cache data into a table, useful for
# display at runtime.

SRCDIR=`dirname $0`

OUT=cfg_defs.h

cat >$OUT <<EOF
#ifndef CFG_DEFS_H
#define CFG_DEFS_H 1

static CONST struct {
	CONST char *name;
	CONST char *value;
} config_cache[] = {
EOF

sed \
	-e '/^#/d'     \
	-e 's/^.[^=]*_cv_//' \
	-e 's/=\${.*=/=/'  \
	-e 's/}$//'          \
	config.cache | /bin/sh ${SRCDIR}/cfg_edit.sh >>$OUT

cat >>$OUT <<EOF
};

static CONST struct {
	CONST char *name;
	CONST char *value;
} config_defines[] = {
EOF
fgrep	'#define' lynx_cfg.h |
sed	-e 's@	@ @g' \
	-e 's@  @ @g' \
	-e 's@^[ 	]*#define[ 	]*@@' \
	-e 's@[ ]*/\*.*\*/@@' \
	-e 's@[ 	][ 	]*@=@' \
    | /bin/sh ${SRCDIR}/cfg_edit.sh >>$OUT

cat >>$OUT <<EOF
};

#endif /* CFG_DEFS_H */
EOF