Blob


1 #!/usr/local/plan9/bin/rc
2 # joyless reimplementation of soelim
3 # the $0 recursion is a bit ugly
5 # canonicalise troff commands first with sed into ". so file" form.
6 # but the space after the dot has to come out; tbl can't cope with it.
7 # friggin' html macros can be longer than two characters; grrr.
8 sed '/^[.'']/{
9 s/([^\\])\\".*$/\1/
10 # s/^(.)[ ]*([^ \\][^ \\])[ ]*/\1 \2 /
11 s/^(.)[ ]*([^ \\][^ \\])/\1 \2/
12 }' $* | awk ' BEGIN { me = "'$0'" }
13 $1 !~ /^[.'']$/ { print; next }
14 $2 == "so" { system(me " " $3) ; next }
15 $2 == "nx" { system(me " " $3) ; exit }
16 { print }' | sed 's/^([.'']) /\1/'