sub cmd_unixlong { my ($obj, $cmd) = @_; my ($line, $pos); my $max_tty_line = 254; ## Start a Bourne shell. $obj->cmd(-string => "/usr/bin/env " . "'PS1= ' 'PS2= ' /bin/sh -i", -prompt => '/ $/') or return; ## Break-up the one large command line and send as shorter lines. $pos = 0; while (1) { $line = substr $cmd, $pos, $max_tty_line; $pos += length $line; last unless $pos < length $cmd; ## Send the line with continuation char. $obj->cmd(-string => "$line\\", -prompt => '/ $/') or return; } ## Send the last line and return the output. $obj->cmd("$line ; exit"); } # end sub cmd_unixlong #### sub cmd_telnetlong { my ($obj, $cmd) = @_; my ($line, $pos); my $max_tty_line = 254; ## Break-up the one large command line and send as shorter lines. $pos = 0; while (1) { $line = substr $cmd, $pos, $max_tty_line; $pos += length $line; last unless $pos < length $cmd; ## Send the line with continuation char. $obj->cmd(-string => "$line^", -prompt => '/More?/i') or return; } ## Send the last line and return the output. return $obj->cmd("$line ; exit"); } # end sub cmd_unixlong