Article 12695 of comp.lang.perl:
Xref: feenix.metronet.com comp.lang.perl:12695
Newsgroups: comp.lang.perl
Path: feenix.metronet.com!news.utdallas.edu!chpc.utexas.edu!cs.utexas.edu!howland.reston.ans.net!agate!ames!pacbell.com!well!nbn!moon!unicom!gilbert
From:
[email protected] (Tim L Gilbert)
Subject: rtfm: a script for getting FAQs by email
Message-ID: <
[email protected]>
Summary: a short perl script to get a FAQ from rtfm.mit.edu
Keywords: perl, FAQ, mail, rtfm
Organization: College of Marin, Kentfield, CA 94904
X-Newsreader: TIN [version 1.2 PL2]
Date: Tue, 12 Apr 1994 22:25:45 GMT
Lines: 50
Aloha. This is a simple script I have sitting around in my bin
directory; thought I'd share it with y'all. Basically, this just
composes a form letter to the mail server
[email protected].
If you type:
$ rtfm -i comp.lang.perl
you will recieve an index file, and if you say:
$ rtfm news.answers/perl-faq/part1
you will get that file. This is a small subset of a larger program
I am writing which is a sort of "super form letter composer", and
can talk to a variety of mail-servers, including the various ftp-
by-email ones. I will post this as soon as I have added that one
last feature and worked out that one last bug :). Email if you're
interested. Well, here it is:
------------------ snip snip -------------------
#! /usr/bin/perl
# rtfm - get a file from the mail-server at
[email protected].
# usage: rtfm [-i] newsgroup[/file]
if ( $#ARGV < 0 || $#ARGV > 2 ) {
die "usage: rtfm -i newsgroup (index of avaiable FAQs)\n".
" or: rtfm newsgroup/<filename> (get <filename>)\n";
}
$target = '
[email protected]';
print STDERR "Mailing to $target...\n";
open ( MAIL, "| /usr/ucb/mail -s 'rtfm' $target" )
|| die "couldn't pipe to mail!";
if ( $#ARGV == 1 ) {
shift; $filename = shift;
print MAIL "send usenet/$filename/index\n";
}
elsif ( $#ARGV == 0 ) {
$filename = shift;
print MAIL "send usenet/$filename\n";
}
------------------ snip snip -------------------
P.S.: Yes, I know it should be called rtff. The idea of a newbie being
told to "RTFM", then going to the command line and typing it out, and
having something actually happen, was too irresistable <g>. -- Tim
--
Tim Gilbert College of Marin, Kentfield CA
[email protected] All mistakes my own