#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  jam.pl bvi perl-vdb
# Wrapped by tchrist@mox on Sun Oct  8 15:30:27 1995
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'jam.pl' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'jam.pl'\"
else
echo shar: Extracting \"'jam.pl'\" \(245 characters\)
sed "s/^X//" >'jam.pl' <<'END_OF_FILE'
X$SIG{TTOU} = IGNORE;
Xfor (@ARGV) { jam($_) } 
Xsub jam {
X    $TIOCSTI = 0x80017472 # sys dependent
X        unless defined $TIOCSTI;
X    for (split(//, $_[0])) {
X        ioctl(STDERR, $TIOCSTI, $_) 
X            || die "bad TIOCSTI: $!";
X    } 
X} 
END_OF_FILE
if test 245 -ne `wc -c <'jam.pl'`; then
    echo shar: \"'jam.pl'\" unpacked with wrong size!
fi
# end of 'jam.pl'
fi
if test -f 'bvi' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bvi'\"
else
echo shar: Extracting \"'bvi'\" \(731 characters\)
sed "s/^X//" >'bvi' <<'END_OF_FILE'
X#!/usr/bin/perl
X
Xunless (@ARGV == 1 and -p ($fifo = shift)) { die "usage: $0 fifo"; }
X
X$editor = $ENV{EDITOR} || 'vi';
X
X$TIOCSTI = 0x80017472; # sys dependent
X$SIG{TTOU} = 'IGNORE';
X
Xopen(TTY, "/dev/tty") || die "no /dev/tty: $!";
Xdie "can't fork: $!" unless defined ($pid = fork);
Xunless ($pid) {
X    exec $editor;
X    die "can't exec $editor";
X}
X#sleep 2;
Xjam (":set ro\n");
Xjam (":set nu\n");
Xopen (FIFO, $fifo) || die "can't open $fifo: $!";
X
Xwhile (<FIFO>) {
X    ($file, $line) = split;
X    if ($file ne $oldfile) {
X	jam(":n +$line $file\n");
X	$oldfile = $file;
X    } else {
X	jam("${line}G");
X    } 
X} 
Xunlink $fifo;
X
Xsub jam {
X    for (split(//, $_[0])) {
X        ioctl(TTY, $TIOCSTI, $_) || die "bad TIOCSTI: $!";
X    } 
X} 
END_OF_FILE
if test 731 -ne `wc -c <'bvi'`; then
    echo shar: \"'bvi'\" unpacked with wrong size!
fi
chmod +x 'bvi'
# end of 'bvi'
fi
if test -f 'perl-vdb' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'perl-vdb'\"
else
echo shar: Extracting \"'perl-vdb'\" \(1996 characters\)
sed "s/^X//" >'perl-vdb' <<'END_OF_FILE'
X#!/usr/bin/perl
X
X$ENV{PATH} .= ":/etc";
X
Xuse POSIX qw(setsid);
X
X$file = shift || die "usage: $0 file [args]\n";
X-r $file or die "can't read $file: $!";
X
X($short = $file) =~ s,.*/,,;
X$fifo = "/tmp/pvd-fifo.$$";
Xunlink $fifo;
X$SIG{INT} = IGNORE;
Xsystem("mknod $fifo p") and die "mknod failed";
X
Xunless (defined ($xtpid = fork)) {
X    die "can't fork: $!";
X} 
Xunless ($xtpid) {
X    POSIX::setsid();
X    exec "xterm",   -fg		=> Red,
X		    -bg		=> LightSkyBlue1,
X		    -n 		=> "bvi $short",
X		    -T 		=> "bvi $short", 
X		    -geom	=> '94x55',
X		    -e 		=> "bvi", $fifo;
X    die "can't exec xterm: $!";
X} 
X
X
X$FIONREAD = 0x4004667f;
X$| = 1;
X
X$SIG{CHLD} = sub {
X    $pid = wait;
X    if ($pid == $kidpid) {
X	unlink $fifo;
X	die "Whoops, that debugger just exited.\n";
X    } 
X}; 
X
Xunless (defined ($kidpid = open(KID, "-|"))) {
X    die "can't fork: $!";
X} 
X
Xopen(FIFO, ">$fifo") || die "can't open $fifo: $!";
Xselect((select(FIFO), $| = 1)[0]);
X
Xif ($kidpid) {
X    print "Starting $kidpid\n";
X    $/ = '>';
X    while ($_ = getline(*KID)) {
X	if (s/(.*?)\032\032(.*?):(\d+):0\n//) {
X	    ($preamble, $file, $line) = ($1, $2, $3);
X	    print $preamble;
X	    if ($file =~ /\beval\b/) {
X		print "(can't break in $file $line)\n";
X	    } else {
X		print FIFO "$file $line\n";
X	    }
X	    redo;
X	} else {
X	    print;
X	} 
X    } 
X} else {
X    $ENV{perldb_pipe} = 1;
X    $SIG{INT} = DEFAULT;
X    exec 'perl5-old', '-d', $file, '-emacs', @ARGV;
X    die "Can't exec debugger: $!";
X} 
X
X
Xsub getline {
X    my $fh = $_[0];
X    my $buf = '';
X    while (1) { 
X	$smask = '';
X	$long = pack("L", 0);
X	vec($smask, fileno($fh), 1) = 1;
X	$ok = select($smask, undef, undef, $buf ? 0.25 : undef);
X	if (!$ok) {
X	    return $buf if $buf;
X	    warn "select: $!";
X	    next;
X	} 
X	ioctl($fh, $FIONREAD, $long) or die "can't FIONREAD: $!";
X	$count = unpack("L", $long);
X	die "count is empty" unless $count =~ /\d/;
X	sysread($fh, $chars, $count);
X	$buf .= $chars;
X	if ($buf =~ /DB<\d+> $/ or $buf =~ /\n/) {
X	    return $buf;
X	} 
X    }
X} 
END_OF_FILE
if test 1996 -ne `wc -c <'perl-vdb'`; then
    echo shar: \"'perl-vdb'\" unpacked with wrong size!
fi
chmod +x 'perl-vdb'
# end of 'perl-vdb'
fi
echo shar: End of shell archive.
exit 0
