aboutsummaryrefslogtreecommitdiff
path: root/bin/soelim
diff options
context:
space:
mode:
authorsean <phonologus@gmail.com>2020-01-15 08:28:14 +0000
committerDan Cross <crossd@gmail.com>2020-01-15 08:27:57 -0500
commit40685d24d894a0948ead2693c12636a967c24d2e (patch)
tree3d905c6bce2f88ca51674ff8e1a195342fecca2b /bin/soelim
parent5c06214952017d03f5e36bd1fbf25c1969922d80 (diff)
downloadplan9port-40685d24d894a0948ead2693c12636a967c24d2e.tar.gz
plan9port-40685d24d894a0948ead2693c12636a967c24d2e.tar.bz2
plan9port-40685d24d894a0948ead2693c12636a967c24d2e.zip
soelim: import from Plan9
Add entry in lib/moveplan9.files to trigger relocation during INSTALL.
Diffstat (limited to 'bin/soelim')
-rwxr-xr-xbin/soelim16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/soelim b/bin/soelim
new file mode 100755
index 00000000..2ba3de99
--- /dev/null
+++ b/bin/soelim
@@ -0,0 +1,16 @@
+#!/usr/local/plan9/bin/rc
+# joyless reimplementation of soelim
+# the $0 recursion is a bit ugly
+
+# canonicalise troff commands first with sed into ". so file" form.
+# but the space after the dot has to come out; tbl can't cope with it.
+# friggin' html macros can be longer than two characters; grrr.
+sed '/^[.'']/{
+ s/([^\\])\\".*$/\1/
+# s/^(.)[ ]*([^ \\][^ \\])[ ]*/\1 \2 /
+ s/^(.)[ ]*([^ \\][^ \\])/\1 \2/
+}' $* | awk ' BEGIN { me = "'$0'" }
+ $1 !~ /^[.'']$/ { print; next }
+ $2 == "so" { system(me " " $3) ; next }
+ $2 == "nx" { system(me " " $3) ; exit }
+ { print }' | sed 's/^([.'']) /\1/'