aboutsummaryrefslogtreecommitdiff
path: root/bin/tref
blob: d06e9a0599966ad285596916dc7df96701312b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
}

' $*