diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-02-11 13:40:11 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-02-11 13:40:11 +0100 |
commit | 9c79e48c93c0c4d14aabcb490fab048d68934cb2 (patch) | |
tree | 1d57d3fd193621a2357473bb65b92190914c5736 /bin/soelim | |
parent | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (diff) | |
parent | 0237dec768a4ee36ae9e18ce8566d2c999d78410 (diff) | |
download | plan9port-9c79e48c93c0c4d14aabcb490fab048d68934cb2.tar.gz plan9port-9c79e48c93c0c4d14aabcb490fab048d68934cb2.tar.bz2 plan9port-9c79e48c93c0c4d14aabcb490fab048d68934cb2.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'bin/soelim')
-rwxr-xr-x | bin/soelim | 16 |
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/' |