#! /opt/local/bin/perl
$ENV{'PATH'} = "/usr/bin";
$| = 1;
if ($ARGV[0] eq "paper" || $ARGV[0] eq "color" || $ARGV[0] eq "phaser-425D" ||
    $ARGV[0] eq "phaser" || $ARGV[0] eq "phaser425D") {
    $queue = "phaser-425D";
}
elsif (substr($ARGV[0],0,5) eq "trans" || $ARGV[0] eq "phasertrans-425D" ||
       $ARGV[0] eq "phasertrans425D" || $ARGV[0] eq "phasertrans") {
    $queue = "phasertrans-425D";
}
elsif ($ARGV[0] eq "BW" || $ARGV[0] eq "bw" || $ARGV[0] eq "phaserBW-425D" ||
       $ARGV[0] eq "phaserBW425D" || $ARGV[0] eq "phaserBW") {
    $queue = "phaserBW-425D";
}
else {
    print "Illegal option - $ARGV[0]\n";
    print "Possible options with aliases are:\n\n";
    print "phaser-425D\t\tphaser, phaser425D, paper, color\n";
    print "phasertrans-425D\tphasertrans, phasertrans425D, trans\n";
    print "phaserBW-425D\t\tphaserBW, phaserBW425D, BW, bw\n";
    exit(1);
}
$host = `/usr/ucb/hostname`;
chop $host;
if ($host ne dry) {
    $> = $<;
    exec "/usr/ucb/rsh dry set_phaser $queue";
    print "exec failed\n";
    exit(1);
}
$< = $>;
system "$rsh/usr/etc/lpc stop phaser-425D";
system "$rsh/usr/etc/lpc stop phaserBW-425D";
system "$rsh/usr/etc/lpc stop phasertrans-425D";
print "\nWait for the printer to become idle.\n";
print "Set up the printer for the new queue and hit return when ready";
$c = <STDIN>;
exec "$rsh/usr/etc/lpc start $queue";


