#!/usr/local/bin/zsh # # $Id: rfc.zsh,v 1.1 2003/12/23 00:24:20 dope Exp dope $ # # Copyright by Christian Schneider # # Filename : ~/bin/rfc.zsh # Purpose : Search and read (local) RFCs # Author : Christian Schneider # Latest release : # # Last modified: [ 2004-03-07 18:02:15 ] # # "rfc --find MIME" should display the first line of the # descriptions for all RFCs regarding MIME, along with # their numbers. # # Search for a RFC # $ rfc --find foobar # Read RFC by number (i. e. RFC 1036) # $ rfc 1036 # Read the RFC index # $ rfc cd /backups/RFCs if [[ "$1" == "--find" ]] ; then shift what=$1 zcat rfc-index.txt.gz \ |gawk -v what=$what \ 'BEGIN {IGNORECASE=1;s="^[0-9].+"what} /\(Format:/ {gsub(/\(Format:/,"")} $0~s {p=1;print;next} p {if(/^[0-9]/)print;else p=0} ' else case $1 in fyi*) ${BROWSER:-lynx} $1.* ;; "") ${BROWSER:-lynx} rfc-index.txt.gz ;; *) ${BROWSER:-lynx} rfc$1.* ;; esac fi cd - >/dev/null 2>&1