aboutsummaryrefslogtreecommitdiff
path: root/bin/tref
diff options
context:
space:
mode:
authorwkj <devnull@localhost>2004-05-17 03:22:35 +0000
committerwkj <devnull@localhost>2004-05-17 03:22:35 +0000
commitaa83d77271f0d2be72067058f78abd1780f3b69e (patch)
tree14a24e73abb43ad0b7340a1623e077a733b0be33 /bin/tref
parenta7eb134e8717c2ea831066891314cf74fa4a6ad3 (diff)
downloadplan9port-aa83d77271f0d2be72067058f78abd1780f3b69e.tar.gz
plan9port-aa83d77271f0d2be72067058f78abd1780f3b69e.tar.bz2
plan9port-aa83d77271f0d2be72067058f78abd1780f3b69e.zip
More troff bits; if you want them elsewhere, feel free to repo copy them.
Diffstat (limited to 'bin/tref')
-rwxr-xr-xbin/tref31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/tref b/bin/tref
new file mode 100755
index 00000000..d06e9a05
--- /dev/null
+++ b/bin/tref
@@ -0,0 +1,31 @@
+awk '
+BEGIN{
+ print ".nr Rp 1" # supress ... Rx lines
+ first=1
+}
+
+#these come first
+$1=="..." && $2=="Rx"{
+ ref[$4] = $3
+ next
+}
+
+first {
+ printf(".lf %d %s\n", 1, inputfile)
+ lineoffset=NR-1
+ first=0
+}
+
+$1==".Rf"{
+ if($2 in ref)
+ $2=ref[$2]
+ else
+ printf("tref: %s:%d: no ref for %s\n",
+ inputfile, NR-lineoffset, $2) >"/dev/stderr"
+}
+
+{
+ print
+}
+
+' $*