Random Zsigs

Previous: Pings

Up: Simple Zephyr Hacks and Customizations

Next: Colors and Locations


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 two 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 700 .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
	endif
@ index = $index % $#zsigs
@ index = $index + 1
endif
zwrite -s "$zsigs[$index]" $argv:q
echo "$zsigs[$index]"
The perl randomizer was written by SIPB member Matthew Gray, <mkgray>. In order to use it, you need to create a file of your zsigs, 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 executable 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:

#!/afs/athena/contrib/perl/perl
 
srand;
open(ZSIGS, "/mit/$ENV{'USER'}/.zsigs")|| die("No ~/.zsigs file");
$ops = join(' ', @ARGV);
     while(<ZSIGS>){
        chop;
        $sig[$i++]=$_;
    }
    $x = rand($i-1);
    print("Zsig: $sig[$x]\n");
    exec("zwrite", "-d", "-s", $sig[$x], split(' ',$ops));