summaryrefslogtreecommitdiff
path: root/scripts/cfg_edit.sh
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-09-24 22:26:00 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-09-24 22:26:00 +0200
commitc2ecaf87e462fd6600ce5ee6a29cb352de042714 (patch)
tree70f607a8c9bce7f0d40c559ec4112d3dd154eb50 /scripts/cfg_edit.sh
downloadlynx-c2ecaf87e462fd6600ce5ee6a29cb352de042714.tar.gz
lynx-c2ecaf87e462fd6600ce5ee6a29cb352de042714.tar.bz2
lynx-c2ecaf87e462fd6600ce5ee6a29cb352de042714.zip
update
Diffstat (limited to 'scripts/cfg_edit.sh')
-rwxr-xr-xscripts/cfg_edit.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/cfg_edit.sh b/scripts/cfg_edit.sh
new file mode 100755
index 0000000..99f00be
--- /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 '" },'
+LC_ALL=C sort |
+sed -e 's!^[ ]*!!' -e 's![ ]*$!!' \
+ -e 's!\\!\\\\!g' \
+ -e 's!"!\\"!g' \
+ -e 's!&!\&amp;!g' -e 's!<!\&lt;!g' -e 's!>!\&gt;!g' \
+ -e 's!^[^=]*$!&=!' \
+ -e 's!=!", "!' \
+ -e 's!^! { "!' -e 's!$!" },!'