mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
32 lines
358 B
Text
32 lines
358 B
Text
|
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
|
||
|
}
|
||
|
|
||
|
' $*
|