mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-19 03:35:12 +00:00
Merge pull request #389 from liutec/patch-1
Allow setting the terminal window size other than 80x24 * liutec/patch-1: Removed white-spaces from line ends Allow setting the terminal window size
This commit is contained in:
commit
a40e6a0838
@ -818,6 +818,28 @@ class Net_SSH2
|
|||||||
*/
|
*/
|
||||||
var $connectionTimeout;
|
var $connectionTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of columns for terminal window size
|
||||||
|
*
|
||||||
|
* @see Net_SSH2::getWindowColumns()
|
||||||
|
* @see Net_SSH2::setWindowColumns()
|
||||||
|
* @see Net_SSH2::setWindowSize()
|
||||||
|
* @var Integer
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $windowColumns = 80;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of columns for terminal window size
|
||||||
|
*
|
||||||
|
* @see Net_SSH2::getWindowRows()
|
||||||
|
* @see Net_SSH2::setWindowRows()
|
||||||
|
* @see Net_SSH2::setWindowSize()
|
||||||
|
* @var Integer
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $windowRows = 24;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
*
|
*
|
||||||
@ -2268,7 +2290,7 @@ class Net_SSH2
|
|||||||
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
|
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
|
||||||
$packet = pack('CNNa*CNa*N5a*',
|
$packet = pack('CNNa*CNa*N5a*',
|
||||||
NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_EXEC], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100',
|
NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_EXEC], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100',
|
||||||
80, 24, 0, 0, strlen($terminal_modes), $terminal_modes);
|
$this->windowColumns, $this->windowRows, 0, 0, strlen($terminal_modes), $terminal_modes);
|
||||||
|
|
||||||
if (!$this->_send_binary_packet($packet)) {
|
if (!$this->_send_binary_packet($packet)) {
|
||||||
return false;
|
return false;
|
||||||
@ -2375,7 +2397,7 @@ class Net_SSH2
|
|||||||
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
|
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
|
||||||
$packet = pack('CNNa*CNa*N5a*',
|
$packet = pack('CNNa*CNa*N5a*',
|
||||||
NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_SHELL], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100',
|
NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_SHELL], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100',
|
||||||
80, 24, 0, 0, strlen($terminal_modes), $terminal_modes);
|
$this->windowColumns, $this->windowRows, 0, 0, strlen($terminal_modes), $terminal_modes);
|
||||||
|
|
||||||
if (!$this->_send_binary_packet($packet)) {
|
if (!$this->_send_binary_packet($packet)) {
|
||||||
return false;
|
return false;
|
||||||
@ -3775,4 +3797,61 @@ class Net_SSH2
|
|||||||
}
|
}
|
||||||
return $this->exit_status;
|
return $this->exit_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of columns for the terminal window size.
|
||||||
|
*
|
||||||
|
* @return Integer
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function getWindowColumns()
|
||||||
|
{
|
||||||
|
return $this->windowColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows for the terminal window size.
|
||||||
|
*
|
||||||
|
* @return Integer
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function getWindowRows()
|
||||||
|
{
|
||||||
|
return $this->windowRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of columns for the terminal window size.
|
||||||
|
*
|
||||||
|
* @param Integer $value
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function setWindowColumns($value)
|
||||||
|
{
|
||||||
|
$this->windowColumns = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of rows for the terminal window size.
|
||||||
|
*
|
||||||
|
* @param Integer $value
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function setWindowRows($value)
|
||||||
|
{
|
||||||
|
$this->windowRows = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of columns and rows for the terminal window size.
|
||||||
|
*
|
||||||
|
* @param Integer $columns
|
||||||
|
* @param Integer $rows
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function setWindowSize($columns = 80, $rows = 24)
|
||||||
|
{
|
||||||
|
$this->windowColumns = $columns;
|
||||||
|
$this->windowRows = $rows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user