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 /bin | |
parent | Add pit(1) (diff) | |
download | dotfiles-f7e0e8afd841f2d390f4727be1dd556dcf3f5b07.tar.gz dotfiles-f7e0e8afd841f2d390f4727be1dd556dcf3f5b07.zip |
Add rfcf(1), rfcr(1), and rfct(1)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rfcf | 5 | ||||
-rwxr-xr-x | bin/rfcr | 11 | ||||
-rwxr-xr-x | bin/rfct | 15 |
3 files changed, 31 insertions, 0 deletions
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 } |