Fix bug introduced with syswrite fix in 2.24 that stopped arrow keys working

This commit is contained in:
duncan_ferguson 2004-08-13 15:13:29 +00:00
parent 7607a332bc
commit 126d3474ca
2 changed files with 28 additions and 15 deletions

View file

@ -69,6 +69,8 @@ use Fcntl;
use Getopt::Std;
my %options;
sub exit_prog();
getopts('vx:y:z:d', \%options);
if($options{v})
@ -85,9 +87,14 @@ unless ($ENV{TERM}) {
$SIG{CHLD}='IGNORE';
# die gracefully if we get any signals we cannot otehrwise handle
use sigtrap qw(handler \&exit_prog untrapped normal-signals old-interface-signals);
# autoflush output
$|=1;
my $pid;
if($options{x})
{
if( ! -p $options{x} || ! $options{y} || ! $options{z})
@ -105,7 +112,7 @@ if($options{x})
print "pipe=$options{x}\n";
}
my $pid=fork();
$pid=fork();
if(!defined($pid))
{
@ -161,15 +168,7 @@ if($options{x})
select(undef,undef,undef,0.25);
}
}
print "Killing $pid\n" if($options{d} && kill(0,$pid));
kill(9,$pid) if (kill(0,$pid));
print "Removing pipe\n" if($options{d} && -p $options{x});
unlink($options{x}) if(-p $options{x});
print "sleeping for 25 seconds for reading any debug\n" if($options{d});
sleep 25 if($options{d});
exit;
exit_prog();
}
warn("Weird error - should never get here: $!") if($options{d});
die("Weird error - should never get here: $!");
@ -178,9 +177,23 @@ if($options{x})
die ("cchp should only be called via cssh/crsh\n");
}
sub exit_prog()
{
print "Killing $pid\n" if($options{d} && kill(0,$pid));
kill(9,$pid) if (kill(0,$pid));
print "Removing pipe\n" if($options{d} && -p $options{x});
unlink($options{x}) if(-p $options{x});
print "sleeping for 25 seconds for reading any debug\n" if($options{d});
sleep 25 if($options{d});
exit;
}
############################################################################
# $Log$
# Revision 1.8 2004/08/13 15:13:29 duncan_ferguson
# Fix bug introduced with syswrite fix in 2.24 that stopped arrow keys working
#
# Revision 1.7 2004/05/10 12:32:15 duncan_ferguson
# Remove perl interpreter from line 1
# Correct -v output to use program name, not "Version:"

View file

@ -769,10 +769,7 @@ sub send_character_to_server
# send the characters unbuffered via pipe
{
local $SIG{PIPE} = 'IGNORE';
if(!syswrite($servers{$serv_name}[3], $char))
{
delete_host($serv_name);
}
syswrite($servers{$serv_name}[3], $char);
}
} else {
delete_host($serv_name);
@ -785,8 +782,8 @@ sub send_character {
foreach (keys(%servers))
{
send_character_to_server($_,$char);
print "Sending :$char: to $_\n" if($options{d});
send_character_to_server($_,$char);
}
$entrytext="";
}
@ -1362,6 +1359,9 @@ L<Config::Simple>
# Moved to sf.net cvs
#
# $Log$
# Revision 2.27 2004/08/13 15:13:29 duncan_ferguson
# Fix bug introduced with syswrite fix in 2.24 that stopped arrow keys working
#
# Revision 2.26 2004/08/04 12:08:39 duncan_ferguson
# Changes contact location in help->about
#