Article View: news.software.readers
Article #82152Re: [slrn] signature handling
From: Karen Lofstrom
Date: Sun, 29 Jul 2001 19:59
Date: Sun, 29 Jul 2001 19:59
78 lines
3500 bytes
3500 bytes
In article <9ju1k6$kip$1@mochi.lava.net>, Karen Lofstrom wrote:
> Thank you for the suggestion. Jurriaan is wrestling with the problem right
> now (nice guy) but if he doesn't have time to come up with a fix, I might
> investigate this.
Jurriaan wrestled with it and solved it. Solution:
A line in my .slrnrc that reads:
interpret .slrn.slang
A file in my home directory, called .slrn.slang, that reads:
static variable _Random_Seed = 123456789UL;
% random function copied from another slrn macro
static define random (min, max)
{
variable rslt;
_Random_Seed = (_Random_Seed * 69069UL + 1013904243UL)&0xFFFFFFFFU;
rslt = _Random_Seed/4294967296.0 ;
rslt = typecast(min, Double_Type) + ( rslt * typecast( ( max - min),
Double_Type));
return typecast(rslt, Integer_Type);
}
define RandomSignature()
{
variable max_sig, cur_sig, sig_file;
variable fp;
% make sure we don't start with the same signature always
if ( _Random_Seed == 123456789UL )
{
% seed computation from Angband; _time = time since 1-1-1970 in seconds
% getpid() returns process-identification-number
_Random_Seed = (( _time () shr 3 ) * ( getpid() shl 1 ) ) &
0xFFFFFFFFU;
}
% how many sigs are there? find out. We assume there's no sigs 'missing' !
fp = popen ("ls ~/.Sig/sig[0-9]* | wc -l | tr -d \" \"", "r");
() = fgets (&max_sig, fp);
() = pclose(fp);
% now choose a random signature
cur_sig = random (1, typecast(max_sig, Integer_Type));
sig_file = sprintf(".Sig/sig%d", cur_sig);
% and make sure slrn uses it.
set_string_variable("signature", sig_file);
}
% on posting or when following-up, define a random signature.
define followup_hook ()
{
RandomSignature();
}
define post_hook ()
{
RandomSignature();
}
=====================================================================
Many thanks to Jurriaan for his patience and good humor in working
through several iterations of this script.
Now slrn has all the functionality of my beloved old
tin, and MORE. Wow!
--
Karen Lofstrom lofstrom@lava.net
----------------------------------------------------------------------
I don't see, Mr Speaker, why we should put ourselves out of the way to
serve posterity. What has posterity ever done for us?" -- Boyle Roche
Technical Details
Message-ID:
<9k1pum$q9p$1@mochi.lava.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!lsanca1-snf1!news.gtei.net!news.lava.net!not-for-mailReferences:
<9jgfld$mbj$1@mochi.lava.net> <slrn9lnknb.500.no_spam_here@middle.of.nowhere> <9jkos5$ot6$1@mochi.lava.net> <9jo6mb22n72@enews1.newsguy.com> <9jqin0$4e8$1@mochi.lava.net> <slrn9m2avt.dvh.ihr.name@camioneta.letras.de> <9ju1k6$kip$1@mochi.lava.net>Show Full Headers
Complete Article Headers
Message-ID: <9k1pum$q9p$1@mochi.lava.net> Subject: Re: [slrn] signature handling Date: Sun, 29 Jul 2001 19:59:18 +0000 From: lofstrom@lava.net (Karen Lofstrom) References: <9jgfld$mbj$1@mochi.lava.net> <slrn9lnknb.500.no_spam_here@middle.of.nowhere> <9jkos5$ot6$1@mochi.lava.net> <9jo6mb22n72@enews1.newsguy.com> <9jqin0$4e8$1@mochi.lava.net> <slrn9m2avt.dvh.ihr.name@camioneta.letras.de> <9ju1k6$kip$1@mochi.lava.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!lsanca1-snf1!news.gtei.net!news.lava.net!not-for-mail Newsgroups: news.software.readers Organization: Electric Teeth Lines: 77 NNTP-Posting-Host: malasada.lava.net X-Trace: mochi.lava.net 996436758 26937 64.65.64.17 (29 Jul 2001 19:59:18 GMT) X-Complaints-To: abuse@lava.net NNTP-Posting-Date: 29 Jul 2001 19:59:18 GMT User-Agent: slrn/0.9.7.1 (BSD/OS)