ttref - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       ttref (358B)
       ---
            1 awk '
            2 BEGIN{
            3         print ".nr Rp 1"        # supress ... Rx lines
            4         first=1
            5 }
            6 
            7 #these come first
            8 $1=="..." && $2=="Rx"{
            9         ref[$4] = $3
           10         next
           11 }
           12 
           13 first {
           14         printf(".lf %d %s\n", 1, inputfile)
           15         lineoffset=NR-1
           16         first=0
           17 }
           18 
           19 $1==".Rf"{
           20         if($2 in ref)
           21                 $2=ref[$2]
           22         else
           23                 printf("tref: %s:%d: no ref for %s\n",
           24                         inputfile, NR-lineoffset, $2) >"/dev/stderr"
           25 }
           26 
           27 {
           28         print
           29 }
           30 
           31 ' $*