Re: SLRN random-sig files, found this but stilll
On Fri, 24 Sep 2004 01:55:23 +0200, Josef Oswald <oswald@chello.at> wrote:
> looking to set up random sig with SLRN I found this link:
> http://lists.infodrom.org/debian-user-de/2001/03/att-0026/01-slrn-random-sig
Here's what I wrote for my own use. It uses a single file of quotes.
Consider this in the public domain. I found that running it in my
.cshrc changed my signature often enough for my tastes, but you could
go nuts and set up a cron job that runs every minute if you really
want to (not that I could stop you anyway). It should be pretty
obvious how to tailor it to however you'd like your .sig to look.
#!/usr/bin/env perl
#
# This script takes an input file of quotes separated by blank
# lines and chooses a random one to output. If you don't give
# it an output file, it uses standard out (STDOUT). If you don't
# give it an input file, it uses standard in (STDIN). If it
# can't open either file, it uses STDIN or STDOUT.
#
# The full usage is:
#
# ranquotes [infile [outfile]]
#
# Original version 5/13/96 by Michael A. Marsh
#
open(INFILE,"-");
open(OUTFILE,">-");
if (@ARGV) {
if (!open(INFILE,shift(@ARGV))) {
print STDERR "Can\'t find file to open.\nUsing STDIN.\n";
open(INFILE,"-");
}
}
if (@ARGV) {
if (!open(OUTFILE,">" . shift(@ARGV))) {
print STDERR "Can\'t open output file.\nUsing STDOUT.\n";
open(OUTFILE,">-");
}
}
$/ = "";
while (<INFILE>) {
push(@quotes,$_);
}
srand;
print OUTFILE "John Q. Public ";
print OUTFILE "jqp\@fake.domain ";
print OUTFILE "http://your.favorite.url\n";
print OUTFILE splice(@quotes, int(rand(@quotes)), 1);
--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
Reply to: