summary refs log tree commit diff
path: root/doc/rfc/rfc.in
blob: 16081c83edc10300ca6785a947714bc381edfdaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
set -eu

mktemp='mktemp -t rfc'
[ "$(uname)" = 'OpenBSD' ] && mktemp="${mktemp}.XXXXXXXXXX"

rfc=%%PREFIX%%/share/rfc/"rfc${1:--index}.txt"
tags=$($mktemp)
trap 'rm "${tags}"' EXIT

if test -f "${rfc}.gz"; then
	txt=$($mktemp)
	trap 'rm "${txt}" "${tags}"' EXIT
	gunzip -c "${rfc}.gz" >"${txt}"
	rfc=$txt
fi

%%PREFIX%%/bin/rfctags "${rfc}" >"${tags}"
${PAGER:-less} -T "${tags}" "${rfc}"