Random Zsigs

Many people have used their copious free time to devise methods of sending zephyrgrams through some sort of program that chooses a zsig randomly from a list of quotes they have chosen. In this section, I will suggest three programs that work as zsig randomizers. The first is a csh script, written by Ross Lippert, <ripper>. In order to use it, you would need to put the program into a file (calling it .zrandom would work) and add your zsigs. Then, after saving the file, you would need to make it executable using the command chmod 755 .zrandom, and then make an alias such as

alias zr '~/.zrandom'

in your .cshrc.mine file which you would use to zwrite with random zsigs. The program follows:

#!/bin/csh -f
set zsigs = (\
"Your zsig number 1." \
"Your zsig can not easily deal with apostrophes and quotes." \
"Multi-line zsigs are not possible." \
"Exclamation points must be backlashed like this \!" \

set index = `jot -r 1 1 $#zsigs`
if ($index <1 || \$index>$#zsigs) then
        if ($index<0) then
        @ index = - $index
@ index = $index % $#zsigs
@ index = $index + 1
zwrite -s "$zsigs[$index]" $argv:q
echo "$zsigs[$index]"
Another program you can use is a Perl randomizer was written by SIPB member Matthew Gray, <mkgray>. In order to use it, you need to create a file of your zsigs with one zsig on each line, which must be called ~/.zsigs, and then follow a few steps. You would put the perl code into a file, calling it something like .zrandom, make the file execut able using chmod 755 .zrandom, and then alias the execution of the file with a line like

alias zr '~/.zrandom'

in your .cshrc.mine file. The code follows:

open(ZSIGS, "/mit/$ENV{'USER'}/.zsigs")|| die("No ~/.zsigs file");
$ops = join(' ', @ARGV);
    $x = rand($i-1);
    print("Zsig: $sig[$x]\n");
    exec("zwrite", "-d", "-s", $sig[$x], split(' ',$ops));

Yet another randomizer was written by SIPB member Aaron Ucko <amu>. Like the previous randomizer, it uses a file called ~/.zsigs, but with signatures seperated by blank lines. This randomizer allows multiple-line signatures, but please bear in mind that sigs over a certain length are rude.

# -*- perl -*-
die "no arguments" unless @ARGV;
$/ = '';
open(ZSIGS, "$ENV{HOME}/.zsigs");
@zsigs = <ZSIGS>;
$sig = $zsigs[rand(@zsigs)];
chomp $sig;
# $sig .= "\n" if (($sig =~ /.\n./) || (length($sig) >= 60));
exec('/usr/athena/bin/zwrite', '-s', $sig, @ARGV);
% There are a lot of funny comments in this document. That is because 
% emacs font lock mode can't handle verbatim modes and other random
% programming languages thrown into the mix
% $

Geoffrey G Thomas 2009-02-09