diff options
| author | Thomas E. Dickey <dickey@invisible-island.net> | 2006-01-23 01:26:00 -0500 |
|---|---|---|
| committer | Thomas E. Dickey <dickey@invisible-island.net> | 2006-01-23 01:26:00 -0500 |
| commit | 04a316621e7163aa1d3a747c47844da55c6aa4d6 (patch) | |
| tree | 89da810392c92dcde38dafe5313b8602b636b219 /scripts | |
| parent | 01876e39ab4775cc04d1fdc8e491fe2e7de9c1a3 (diff) | |
| download | lynx-snapshots-04a316621e7163aa1d3a747c47844da55c6aa4d6.tar.gz | |
snapshot of project "lynx", label v2-8-6dev_17
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/cfg_defs.sh | 48 | ||||
| -rwxr-xr-x | scripts/cfg_edit.sh | 17 | ||||
| -rwxr-xr-x | scripts/cfg_path.sh | 5 | ||||
| -rwxr-xr-x | scripts/fixtext.sh | 10 |
4 files changed, 80 insertions, 0 deletions
diff --git a/scripts/cfg_defs.sh b/scripts/cfg_defs.sh new file mode 100755 index 00000000..5f37e962 --- /dev/null +++ b/scripts/cfg_defs.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# Translate the lynx_cfg.h and config.cache data into a table, useful for +# display at runtime. + +TOP="${1-.}" +OUT=cfg_defs.h + +# just in case we want to run this outside the makefile +: ${SHELL:=/bin/sh} + +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 | $SHELL $TOP/scripts/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@[ ][ ]*@=@' \ + | $SHELL $TOP/scripts/cfg_edit.sh >>$OUT + +cat >>$OUT <<EOF +}; + +#endif /* CFG_DEFS_H */ +EOF diff --git a/scripts/cfg_edit.sh b/scripts/cfg_edit.sh new file mode 100755 index 00000000..6206c6c4 --- /dev/null +++ b/scripts/cfg_edit.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Invoked from cfg_defs.sh as a filter +# Strip leading and trailing whitespace +# Escape any iternal '\' +# Escape any iternal '"' +# Entify any iternal '&', '<' or '>' +# Append a '=' if none present' +# Break into two strings at '=' +# Prefix ' { "' and suffix '" },' +sort | +sed -e 's!^[ ]*!!' -e 's![ ]*$!!' \ + -e 's!\\!\\\\!g' \ + -e 's!"!\\"!g' \ + -e 's!&!\&!g' -e 's!<!\<!g' -e 's!>!\>!g' \ + -e 's!^[^=]*$!&=!' \ + -e 's!=!", "!' \ + -e 's!^! { "!' -e 's!$!" },!' diff --git a/scripts/cfg_path.sh b/scripts/cfg_path.sh new file mode 100755 index 00000000..40ec863c --- /dev/null +++ b/scripts/cfg_path.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Use this script for substituting the configured path into lynx.cfg - +# not all paths begin with a slash. +SECOND=`echo "$2" | sed -e s,^/,,` +sed -e "/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\+:file/s,/PATH_TO/$1,/$SECOND," diff --git a/scripts/fixtext.sh b/scripts/fixtext.sh new file mode 100755 index 00000000..1f5c1abd --- /dev/null +++ b/scripts/fixtext.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# xgettext only processes literal strings. Someone with a poor sense of humor +# decided to ignore strings in preprocessor lines. So we construct a fake +# ".c" file with the definitions turned into literals. + +sed -e 's/")/");/' \ + -e 's/^#define[ ]*\([^ ]*\)[ ]*gettext/char *\1 = gettext/' \ + -e 's,^#define[ ]*\([^ ]*\)[ ]*\\,/* #define \1 */char *\1 = \\,' \ + $* |