mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-01 17:11:14 +00:00
added -d debug option for some small debug output
This commit is contained in:
parent
d107713209
commit
0ef5aa0ff2
2 changed files with 36 additions and 3 deletions
|
@ -66,7 +66,7 @@ use Fcntl;
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
my %options;
|
my %options;
|
||||||
|
|
||||||
getopts('x:y:z:', \%options);
|
getopts('x:y:z:d', \%options);
|
||||||
|
|
||||||
unless ($ENV{TERM}) {
|
unless ($ENV{TERM}) {
|
||||||
$ENV{TERM} = 'xterm';
|
$ENV{TERM} = 'xterm';
|
||||||
|
@ -84,6 +84,13 @@ if($options{x})
|
||||||
my $TIOCSTI=$options{y};
|
my $TIOCSTI=$options{y};
|
||||||
my $KILLOFF=$options{z};
|
my $KILLOFF=$options{z};
|
||||||
|
|
||||||
|
if($options{d})
|
||||||
|
{
|
||||||
|
print "TIOCSTI=$TIOCSTI\n";
|
||||||
|
print "KILLOFF=$KILLOFF\n";
|
||||||
|
print "pipe=$options{x}\n";
|
||||||
|
}
|
||||||
|
|
||||||
my $pid=fork();
|
my $pid=fork();
|
||||||
|
|
||||||
if(!defined($pid))
|
if(!defined($pid))
|
||||||
|
@ -129,8 +136,10 @@ if($options{x})
|
||||||
{
|
{
|
||||||
while(read($READER,my $char,1))
|
while(read($READER,my $char,1))
|
||||||
{
|
{
|
||||||
|
print "Received:$char:\n" if ($options{d});
|
||||||
last OUTTER if(ord($char) == $KILLOFF);
|
last OUTTER if(ord($char) == $KILLOFF);
|
||||||
|
|
||||||
|
print "Pipe removed\n" if ($options{d} && ! -p $options{x});
|
||||||
last if(! -p $options{x});
|
last if(! -p $options{x});
|
||||||
|
|
||||||
unless(ioctl(STDIN,$TIOCSTI,$char))
|
unless(ioctl(STDIN,$TIOCSTI,$char))
|
||||||
|
@ -145,7 +154,10 @@ if($options{x})
|
||||||
last unless(kill(0,$pid));
|
last unless(kill(0,$pid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print "Killing $pid\n" if($options{d});
|
||||||
|
|
||||||
kill(9,$pid) if (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});
|
unlink($options{x}) if(-p $options{x});
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -157,6 +169,9 @@ if($options{x})
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.2 2004/04/28 08:28:14 duncan_ferguson
|
||||||
|
# added -d debug option for some small debug output
|
||||||
|
#
|
||||||
# Revision 1.1 2004/04/20 12:44:29 duncan_ferguson
|
# Revision 1.1 2004/04/20 12:44:29 duncan_ferguson
|
||||||
# Code split off from cssh version 2.7 in attempt to speed up cx's
|
# Code split off from cssh version 2.7 in attempt to speed up cx's
|
||||||
#
|
#
|
||||||
|
|
|
@ -95,7 +95,7 @@ use Getopt::Std; # command line parsing, incase someone uses -v or -h
|
||||||
my %options;
|
my %options;
|
||||||
|
|
||||||
# NOTE - option x is hidden and should never be called directly
|
# NOTE - option x is hidden and should never be called directly
|
||||||
getopts('x:l:hvncgst:T:', \%options);
|
getopts('x:l:hdvncgst:T:', \%options);
|
||||||
|
|
||||||
my $TIOCSTI = "";
|
my $TIOCSTI = "";
|
||||||
|
|
||||||
|
@ -600,8 +600,11 @@ sub open_windows
|
||||||
|
|
||||||
my $KILLOFF=KILLOFF();
|
my $KILLOFF=KILLOFF();
|
||||||
|
|
||||||
|
my $debug="";
|
||||||
|
$debug="-d" if($options{d});
|
||||||
|
|
||||||
# Start up the terminal via ourselves so the pipes are in place
|
# Start up the terminal via ourselves so the pipes are in place
|
||||||
exec("$user_config{'default.terminal'} $user_config{'default.terminal_options'} $place -title '$method:$serv' -e $FindBin::Bin/cchp -x $servers{$serv_name}[2] -y $TIOCSTI -z $KILLOFF $path_method $serv") or warn("Could not exec session to $serv: $! ");
|
exec("$user_config{'default.terminal'} $user_config{'default.terminal_options'} $place -title '$method:$serv' -e $FindBin::Bin/cchp $debug -x $servers{$serv_name}[2] -y $TIOCSTI -z $KILLOFF $path_method $serv") or warn("Could not exec session to $serv: $! ");
|
||||||
} else {
|
} else {
|
||||||
# parent => fork return process id of child
|
# parent => fork return process id of child
|
||||||
|
|
||||||
|
@ -626,6 +629,17 @@ sub open_windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($options{d})
|
||||||
|
{
|
||||||
|
foreach (keys(%servers))
|
||||||
|
{
|
||||||
|
foreach my $i (0..3)
|
||||||
|
{
|
||||||
|
print "servers{$_}[$i]=$servers{$_}[$i]\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
change_title_number();
|
change_title_number();
|
||||||
|
|
||||||
$mw->configure(-menu=>my $mw_mb=$mw->Menu);
|
$mw->configure(-menu=>my $mw_mb=$mw->Menu);
|
||||||
|
@ -837,6 +851,7 @@ sub send_character {
|
||||||
foreach (keys(%servers))
|
foreach (keys(%servers))
|
||||||
{
|
{
|
||||||
send_character_to_server($_,$char);
|
send_character_to_server($_,$char);
|
||||||
|
print "Sending :$char: to $_\n";
|
||||||
}
|
}
|
||||||
$entrytext="";
|
$entrytext="";
|
||||||
}
|
}
|
||||||
|
@ -1394,6 +1409,9 @@ L<Config::Simple>
|
||||||
# Moved to sf.net cvs
|
# Moved to sf.net cvs
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 2.10 2004/04/28 08:28:14 duncan_ferguson
|
||||||
|
# added -d debug option for some small debug output
|
||||||
|
#
|
||||||
# Revision 2.9 2004/04/20 15:51:50 duncan_ferguson
|
# Revision 2.9 2004/04/20 15:51:50 duncan_ferguson
|
||||||
# Fix bug better for when not using -g
|
# Fix bug better for when not using -g
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue