aboutsummaryrefslogtreecommitdiff
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
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.
-rwxr-xr-xbin/soelim16
-rw-r--r--lib/moveplan9.files1
-rwxr-xr-xman/man1/soelim.130
3 files changed, 47 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/'
diff --git a/lib/moveplan9.files b/lib/moveplan9.files
index 3ce2d596..16535103 100644
--- a/lib/moveplan9.files
+++ b/lib/moveplan9.files
@@ -17,6 +17,7 @@ bin/netfilestat
bin/quote1
bin/quote2
bin/sig
+bin/soelim
bin/spell
bin/src
bin/ssam
diff --git a/man/man1/soelim.1 b/man/man1/soelim.1
new file mode 100755
index 00000000..78b4e2eb
--- /dev/null
+++ b/man/man1/soelim.1
@@ -0,0 +1,30 @@
+.TH SOELIM 1
+.\" .so in the NAME line confuses the ptx machinery; sorry
+.SH NAME
+soelim \- preprocess so inclusion commands in troff input
+.SH SYNOPSIS
+.B soelim
+[
+.I files ...
+]
+.SH DESCRIPTION
+.I Soelim
+reads the specified files or the standard input and performs
+the textual inclusion implied by
+.IR troff (1)
+directives of the form
+.sp
+.ti +2m
+.B "\&.so some_file
+.sp
+when they appear at the beginning of input lines. This is useful when
+using programs such as
+.IR tbl (1)
+that do not normally do this, allowing
+placement of individual tables or other text objects in separate files
+to be run as a part of a large document.
+.SH SOURCE
+.B /rc/bin/soelim
+.SH "SEE ALSO"
+.IR deroff (1),
+.IR troff (1)