usage: rfc <rfc#>
(Yes, I'm too lazy to view them in a browser window which is covered by terminals. :o)
Update: neophyte had a couple of good ideas; I've implemented one of them here.
Update2: (20010517) Implemented merlyn's suggestion of using mirror(), changed the server to one which makes that work.
(View source for the old version)#!/usr/bin/perl -w # example usage: rfc 1459 (gets the IRC RFC) use strict; $|++; use LWP::Simple; use HTTP::Status; die("usage: rfc <rfc#>\n") unless defined($ARGV[0]); my $rfcnum=$ARGV[0]; my $base="ftp://ftp.rfc-editor.org/in-notes/rfc"; my $rfcurl=$base.$rfcnum.".txt"; my $rfcdir="$ENV{HOME}/rfcs"; my $rfcfile="${rfcdir}/rfc${rfcnum}.txt"; my $rfc; my $rc=mirror($rfcurl,$rfcfile); # any 4xx or 5xx error probably means we got no RFC if($rc < 400) { open(RFC,"<$rfcfile") or die("open($rfcfile): $!\n"); local $/ = undef; $rfc=<RFC>; close(RFC); print "$rfc"; } else { print "Failed to fetch ${rfcurl}: $rc ", status_message($rc), "\n" +; } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC fetcher
by larsen (Parson) on Mar 05, 2001 at 20:20 UTC | |
by yakko (Friar) on Mar 06, 2001 at 01:54 UTC | |
|
Re: RFC fetcher
by neophyte (Curate) on Apr 04, 2001 at 13:38 UTC | |
by yakko (Friar) on Apr 04, 2001 at 21:29 UTC | |
by merlyn (Sage) on Apr 04, 2001 at 21:45 UTC | |
|
Re: RFC fetcher
by bladx (Chaplain) on Mar 05, 2001 at 07:34 UTC |