diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-13 20:16:33 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-13 20:17:09 +1200 |
commit | f7e0e8afd841f2d390f4727be1dd556dcf3f5b07 (patch) | |
tree | 8e40a7103fa30000e6235d0c74beaa33ca4a6ce5 | |
parent | Add pit(1) (diff) | |
download | dotfiles-f7e0e8afd841f2d390f4727be1dd556dcf3f5b07.tar.gz dotfiles-f7e0e8afd841f2d390f4727be1dd556dcf3f5b07.zip |
Add rfcf(1), rfcr(1), and rfct(1)
-rw-r--r-- | README.markdown | 5 | ||||
-rwxr-xr-x | bin/rfcf | 5 | ||||
-rwxr-xr-x | bin/rfcr | 11 | ||||
-rwxr-xr-x | bin/rfct | 15 | ||||
-rw-r--r-- | man/man1/rfcf.1 | 15 | ||||
-rw-r--r-- | man/man1/rfcr.1 | 16 | ||||
-rw-r--r-- | man/man1/rfct.1 | 19 |
7 files changed, 86 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 02dea743..1beb4e0a 100644 --- a/README.markdown +++ b/README.markdown @@ -295,6 +295,11 @@ Installed by the `install-bin` target: * `urlc(1)` accepts a list of URLs on `stdin` and writes error messages to `stderr` if any of the URLs are broken, redirecting, or are insecure and have working secure versions; requires `curl(1)` +* Three RFC-related shortcut scripts: + * `rfcf(1)` fetches ASCII RFCs from the IETF website + * `rfct(1)` formats ASCII RFCs + * `rfcr(1)` does both, displaying in a pager if appropriate, like a + `man(1)` reader for RFCs * `dub(1)` lists the biggest entries in a directory. * `edda(1)` provides a means to run `ed(1)` over a set of files preserving any options, mostly useful for scripts. diff --git a/bin/rfcf b/bin/rfcf new file mode 100755 index 00000000..48cc2d43 --- /dev/null +++ b/bin/rfcf @@ -0,0 +1,5 @@ +#!/bin/sh + +# Retrieve the RFC with curl(1) +rn=${1?Need an RFC number} +curl https://tools.ietf.org/rfc/rfc"$rn".txt diff --git a/bin/rfcr b/bin/rfcr new file mode 100755 index 00000000..a11457a9 --- /dev/null +++ b/bin/rfcr @@ -0,0 +1,11 @@ +#!/bin/sh + +# Retrieve the RFC with rfcf(1) +rn=${1?Need an RFC number} +rfcf "$rn" | + +# Pipe it through rfct(1) to format it as text +rfct | + +# Either spit it directly or through a pager +pit diff --git a/bin/rfct b/bin/rfct new file mode 100755 index 00000000..ce15d4d7 --- /dev/null +++ b/bin/rfct @@ -0,0 +1,15 @@ +#!/usr/bin/awk -f + +# A record is a paragraph +BEGIN { + RS="" +} + +# Skip any block without at least one alphanumeric char +!/[[:alnum:]]/ { next } + +# Skip any block with a page break marker in it +// { next } + +# Print the block followed by two newlines +{ printf "%s\n\n", $0 } diff --git a/man/man1/rfcf.1 b/man/man1/rfcf.1 new file mode 100644 index 00000000..2e60ee82 --- /dev/null +++ b/man/man1/rfcf.1 @@ -0,0 +1,15 @@ +.TH RFCF 1 "July 2016" "Manual page for rfcf" +.SH NAME +.B rfcf +\- fetch an RFC from the IETF site and write it to stdout +.SH SYNOPSIS +.B rfc +1918 +.SH DESCRIPTION +.B rfcf +retrieves the RFC with the given number from the IETF website and writes its +contents to stdout. +.SH SEE ALSO +rfct(1), rfcr(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/rfcr.1 b/man/man1/rfcr.1 new file mode 100644 index 00000000..00dcb219 --- /dev/null +++ b/man/man1/rfcr.1 @@ -0,0 +1,16 @@ +.TH RFCR 1 "July 2016" "Manual page for rfcr" +.SH NAME +.B rfcr +\- fetch and format an RFC from the IETF website and view it on a terminal +.SH SYNOPSIS +.B rfcr +1918 +.SH DESCRIPTION +.B rfcr +retrieves the RFC with the given number from the IETF website with rfcf(1), +formats it with rfct(1), and passes the output to pit(1) for either pager +display or simple output. +.SH SEE ALSO +rfcf(1), rfct(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/rfct.1 b/man/man1/rfct.1 new file mode 100644 index 00000000..60d9d3d4 --- /dev/null +++ b/man/man1/rfct.1 @@ -0,0 +1,19 @@ +.TH RFCT 1 "July 2016" "Manual page for rfct" +.SH NAME +.B rfct +\- format the contents of an RFC for nicer reading +.SH SYNOPSIS +.B rfct +rfc1918.txt +.br +rfcf 1918 | +.B rfct +.SH DESCRIPTION +.B rfct +strips page headers and footers and possibly other rubbish from the ASCII +versions of RFC documents as retrieved from the IETF website and writes them to +stdout. +.SH SEE ALSO +rfcf(1), rfcr(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |