summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-18 16:56:05 -0500
committerJune McEnroe <june@causal.agency>2021-01-18 16:56:05 -0500
commit73f6b84e9cfd045d68e30727a57dbd94ad8ae397 (patch)
treea59c6c02b7d0240153c5bcb2ea56ae9f0c999b38 /doc
parentPublish "reusing tags" (diff)
downloadsrc-73f6b84e9cfd045d68e30727a57dbd94ad8ae397.tar.gz
src-73f6b84e9cfd045d68e30727a57dbd94ad8ae397.zip
Don't compress RFCs, add rfc(1) command
Diffstat (limited to 'doc')
-rw-r--r--doc/rfc/.gitignore5
-rw-r--r--doc/rfc/Makefile39
-rw-r--r--doc/rfc/rfc.153
-rw-r--r--doc/rfc/rfc.in8
-rw-r--r--doc/rfc/rfc.vim6
-rw-r--r--doc/rfc/rfctags.pl9
6 files changed, 98 insertions, 22 deletions
diff --git a/doc/rfc/.gitignore b/doc/rfc/.gitignore
index 808cd63e..cc3245d4 100644
--- a/doc/rfc/.gitignore
+++ b/doc/rfc/.gitignore
@@ -1,3 +1,2 @@
-*.txt
-*.txt.gz
-tags
+rfc
+rfctags
diff --git a/doc/rfc/Makefile b/doc/rfc/Makefile
index 87462a6c..445e1163 100644
--- a/doc/rfc/Makefile
+++ b/doc/rfc/Makefile
@@ -1,21 +1,40 @@
 PREFIX ?= ~/.local
+MANDIR ?= ${PREFIX}/share/man
 
+BINS = rfc rfctags
 MODULE = ftp.rfc-editor.org::rfcs-text-only
+RFCS = ${MODULE}/rfc-index.txt ${MODULE}/'rfc[1-9]*.txt'
 
-tags: rfctags.pl rfc-index.txt.gz
-	perl rfctags.pl | sort -f > $@
+all: ${BINS}
 
-rfc-index.txt.gz:
-	rsync -ptz ${MODULE}/rfc-index.txt ${MODULE}/'rfc[1-9]*.txt' .
-	gzip -9f *.txt
+.SUFFIXES: .in .pl
+
+.in:
+	sed 's|%%PREFIX%%|${PREFIX}|g' $< > $@
+	chmod a+x $@
+
+.pl:
+	cp -f $< $@
+	chmod a+x $@
 
 clean:
-	rm -f tags *.txt *.txt.gz
+	rm -f ${BINS}
+
+install: ${BINS} rfc.1
+	install -d ${PREFIX}/bin ${MANDIR}/man1 ${PREFIX}/share
+	install ${BINS} ${PREFIX}/bin
+	install -m 644 rfc.1 ${MANDIR}/man1
+	ln -fs rfc.1 ${MANDIR}/man1/rfctags.1
+	rsync -ptz ${RFCS} ${PREFIX}/share/rfc
 
-install: tags rfc.vim
-	install -d ${PREFIX}/share/rfc ${PREFIX}/share/nvim/site/plugin
-	ln -f tags *.txt.gz ${PREFIX}/share/rfc
+install-nvim: install rfc.vim
+	install -d ${PREFIX}/share/nvim/site/plugin
 	install -m 644 rfc.vim ${PREFIX}/share/nvim/site/plugin
+	(cd ${PREFIX}/share/rfc \
+		&& printf '!_TAG_FILE_SORTED\t2\ttags\n' \
+		&& ${PREFIX}/bin/rfctags *.txt) | sort -f > ${PREFIX}/share/rfc/tags
 
 uninstall:
-	rm -fr ${PREFIX}/share/rfc ${PREFIX}/share/nvim/site/plugin/rfc.vim
+	rm -f ${BINS:%=${PREFIX}/bin/%} ${BINS:%=${MANDIR}/man1/%.1}
+	rm -f ${PREFIX}/share/nvim/site/plugin/rfc.vim
+	rm -fr ${PREFIX}/share/rfc
diff --git a/doc/rfc/rfc.1 b/doc/rfc/rfc.1
new file mode 100644
index 00000000..ece5a901
--- /dev/null
+++ b/doc/rfc/rfc.1
@@ -0,0 +1,53 @@
+.Dd January 18, 2021
+.Dt RFC 1
+.Os
+.
+.Sh NAME
+.Nm rfc ,
+.Nm rfctags
+.Nd view IETF RFCs
+.
+.Sh SYNOPSIS
+.Nm rfc
+.Op Ar number
+.Nm rfctags
+.Op Ar
+.
+.Sh DESCRIPTION
+The
+.Nm rfc
+utility displays
+an IETF RFC by number,
+or the RFC index if no number is specified.
+The RFC is displayed in the
+.Ev PAGER
+with a tags file generated by
+.Nm rfctags .
+.
+.Pp
+The
+.Nm rfctags
+utility generates tags
+for RFC text file
+section numbers,
+section names
+and bracketed references.
+.
+.Sh ENVIRONMENT
+.Bl -tag -width Ds
+.It Ev PAGER
+The program used to display RFCs.
+It must accept the
+.Fl T
+flag for specifying
+the path of the tags file.
+The default is
+.Ev PAGER=less .
+.El
+.
+.Sh SEE ALSO
+.Xr ctags 1 ,
+.Xr less 1
+.
+.Sh AUTHORS
+.An June Bug Aq Mt june@causal.agency
diff --git a/doc/rfc/rfc.in b/doc/rfc/rfc.in
new file mode 100644
index 00000000..adf297eb
--- /dev/null
+++ b/doc/rfc/rfc.in
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -eu
+
+rfc=%%PREFIX%%/share/rfc/"rfc${1:--index}.txt"
+tags=$(mktemp -t rfc)
+trap 'rm "${tags}"' EXIT
+%%PREFIX%%/bin/rfctags "${rfc}" >"${tags}"
+${PAGER:-less} -T "${tags}" "${rfc}"
diff --git a/doc/rfc/rfc.vim b/doc/rfc/rfc.vim
index 2455d8a6..4649cdf5 100644
--- a/doc/rfc/rfc.vim
+++ b/doc/rfc/rfc.vim
@@ -1,5 +1,5 @@
 if !exists('g:rfc_path')
-	let g:rfc_path = expand('<sfile>:h:h:h:h') . '/rfc'
+	let g:rfc_path = fnamemodify(exepath('rfc'), ':h:h') . '/share/rfc'
 endif
 
 function! s:RFC(number)
@@ -8,7 +8,7 @@ function! s:RFC(number)
 	else
 		let number = '-index'
 	endif
-	let path = expand(g:rfc_path . '/rfc' . number . '.txt.gz')
+	let path = expand(g:rfc_path . '/rfc' . number . '.txt')
 	if filereadable(path)
 		execute 'silent' 'noswapfile' 'view' path
 	else
@@ -26,5 +26,5 @@ endfunction
 command! -bar -nargs=? RFC call s:RFC(<q-args>)
 augroup RFC
 	autocmd!
-	autocmd BufRead rfc*.txt.gz call s:BufRead()
+	autocmd BufRead rfc*.txt call s:BufRead()
 augroup END
diff --git a/doc/rfc/rfctags.pl b/doc/rfc/rfctags.pl
index 01324a0d..45e74f9a 100644
--- a/doc/rfc/rfctags.pl
+++ b/doc/rfc/rfctags.pl
@@ -1,14 +1,11 @@
+#!/usr/bin/env perl
 use strict;
 use warnings;
 use open ':encoding(ISO-8859-1)';
 
-use IO::Uncompress::Gunzip qw($GunzipError);
-
 ($,, $\) = ("\t", "\n");
-print '!_TAG_FILE_SORTED', 2, $0; # Promise to pipe this through sort -f
-for my $rfc (<*.txt.gz>) {
-	my $handle = new IO::Uncompress::Gunzip $rfc
-		or die "${rfc}: ${GunzipError}";
+for my $rfc (@ARGV) {
+	open my $handle, '<', $rfc or die "${rfc}: $!";
 	while (<$handle>) {
 		chomp;
 		# Section headings
;Jason@zx2c4.com> Reported-by: Fydor Wire Snark <wsnark@tuta.io> 2019-02-23ui-diff,ui-tag: don't use htmlf with non-formatted stringsChris Mayo Signed-off-by: Chris Mayo <aklhfex@gmail.com> 2019-02-23ui-ssdiff: resolve HTML5 validation errorsChris Mayo - Remove ids from anchor elements. They were unusable because they were duplicated between files and versions of files. - Always close span, with html(). - Fix missing / on closing tr element in cgit_ssdiff_header_end(). Signed-off-by: Chris Mayo <aklhfex@gmail.com> 2019-01-03filters: migrate from luacrypto to luaosslJason A. Donenfeld luaossl has no upstream anymore and doesn't support OpenSSL 1.1, whereas luaossl is quite active. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2019-01-02ui-shared: fix broken sizeof in title setting and rewriteJason A. Donenfeld The old algorithm was totally incorrect. While we're at it, use « instead of \, since it makes more sense. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2018-12-09git: update to v2.20.0Christian Hesse Update to git version v2.20.0. Required changes follow upstream commits: * 00436bf1b1c2a8fe6cf5d2c2457d419d683042f4 (archive: initialize archivers earlier) * 611e42a5980a3a9f8bb3b1b49c1abde63c7a191e (xdiff: provide a separate emit callback for hunks) Signed-off-by: Christian Hesse <mail@eworm.de> 2018-11-25ui-blame: set repo for sbJason A. Donenfeld Otherwise recent git complains and crashes with: "BUG: blame.c:1787: repo is NULL". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2018-11-25auth-filter: pass url with query string attachedJason A. Donenfeld Otherwise redirections come out wrong. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2018-11-21git: use xz compressed archive for downloadChristian Hesse Upstream will stop providing gz compressed source tarballs [0], so stop using them. [0] https://lists.zx2c4.com/pipermail/cgit/2018-November/004254.html Signed-off-by: Christian Hesse <mail@eworm.de> 2018-10-12git: update to v2.19.1Christian Hesse Update to git version v2.19.1. Required changes follow upstream commits: * commit: add repository argument to get_cached_commit_buffer (3ce85f7e5a41116145179f0fae2ce6d86558d099) * commit: add repository argument to lookup_commit_reference (2122f6754c93be8f02bfb5704ed96c88fc9837a8) * object: add repository argument to parse_object (109cd76dd3467bd05f8d2145b857006649741d5c) * tag: add repository argument to deref_tag (a74093da5ed601a09fa158e5ba6f6f14c1142a3e) * tag: add repository argument to lookup_tag (ce71efb713f97f476a2d2ab541a0c73f684a5db3) * tree: add repository argument to lookup_tree (f86bcc7b2ce6cad68ba1a48a528e380c6126705e) * archive.c: avoid access to the_index (b612ee202a48f129f81f8f6a5af6cf71d1a9caef) * for_each_*_object: move declarations to object-store.h (0889aae1cd18c1804ba01c1a4229e516dfb9fe9b) Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11ui-ssdiff: ban strcat()Christian Hesse Git upstream bans strcat() with commit: banned.h: mark strcat() as banned 1b11b64b815db62f93a04242e4aed5687a448748 Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11ui-ssdiff: ban strncpy()Christian Hesse Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11ui-shared: ban strcat()Christian Hesse Git upstream bans strcat() with commit: banned.h: mark strcat() as banned 1b11b64b815db62f93a04242e4aed5687a448748 To avoid compiler warnings from gcc 8.1.x we get the hard way. Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11ui-patch: ban sprintf()Christian Hesse Git upstream bans sprintf() with commit: banned.h: mark sprintf() as banned cc8fdaee1eeaf05d8dd55ff11f111b815f673c58 Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11ui-log: ban strncpy()Christian Hesse Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11ui-log: ban strcpy()Christian Hesse Git upstream bans strcpy() with commit: automatically ban strcpy() c8af66ab8ad7cd78557f0f9f5ef6a52fd46ee6dd Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11parsing: ban sprintf()Christian Hesse Git upstream bans sprintf() with commit: banned.h: mark sprintf() as banned cc8fdaee1eeaf05d8dd55ff11f111b815f673c58 Signed-off-by: Christian Hesse <mail@eworm.de> 2018-09-11parsing: ban strncpy()Christian Hesse Git upstream bans strncpy() with commit: banned.h: mark strncpy() as banned e488b7aba743d23b830d239dcc33d9ca0745a9ad Signed-off-by: Christian Hesse <mail@eworm.de> 2018-08-28filters: generate anchor links from markdownChristian Hesse This makes the markdown filter generate anchor links for headings. Signed-off-by: Christian Hesse <mail@eworm.de> Tested-by: jean-christophe manciot <actionmystique@gmail.com> 2018-08-03Bump version.Jason A. Donenfeld Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2018-08-03clone: fix directory traversalJason A. Donenfeld This was introduced in the initial version of this code, way back when in 2008. $ curl http://127.0.0.1/cgit/repo/objects/?path=../../../../../../../../../etc/passwd root:x:0:0:root:/root:/bin/sh ... Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reported-by: Jann Horn <jannh@google.com> 2018-08-03config: record repo.snapshot-prefix in the per-repo configKonstantin Ryabitsev