3 # Copyright (C) 2000-2003 Simon Huggins
4 # marknlard outputs Mark 'n Lard style attributions
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; either version 2 of the License, or (at your option)
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc., 59
18 # Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # Outputs attribution to tmpdir/M
21 # Therefore replaces @M... in sigs via merge.
25 return if not defined $cfg{'attributions'};
27 my @found = scansigfile("M");
33 # srand( time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required
35 open(HANDLE, "<$cfg{'attributions'}") or htagdie "Could not open $cfg{'attributions'}: $!\n";
36 @attributions=<HANDLE>;
39 open(OUT, ">$cfg{'tmpdir'}/M") or htagdie "$0: Could not open $cfg{'tmpdir'}/M: $!\n";
40 reg_deletion("$cfg{'tmpdir'}/M");
41 foreach my $f (@found) {
44 while ($recursion < 30) {
50 } elsif (length $attr <= $f[1]) {
51 print OUT chunksizealign($attr, $f[1], $f[2]),"\n";
55 if ($recursion != 255) {
56 htagdie "Recursed too much trying to find attribution <= $f[1].\nPerhaps your attributions aren't short enough?\n";
63 my $attribution = $attributions[rand(@attributions)];
65 my ($who,$gender) = split(":",$attribution);
66 return "Is it $who, Mark? Sounds just like $gender.";