GNU Octave
4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
Provides primitives for opening & closing a pseudo TTY pair, assigning the controlling TTY, utmp registration and setting various terminal attributes. More...
#include "kpty.h"
Public Member Functions | |
KPty () | |
Constructor. More... | |
KPty (int masterFd, int slaveFd) | |
~KPty () | |
Destructor: More... | |
void | close () |
Close the pty master/slave pair. More... | |
void | closeSlave () |
Close the pty slave descriptor. More... | |
int | masterFd () const |
bool | open () |
Create a pty master/slave pair. More... | |
bool | setEcho (bool echo) |
Set whether the pty should echo input. More... | |
bool | setWinSize (int lines, int columns) |
Change the logical (screen) size of the pty. More... | |
int | slaveFd () const |
bool | tcGetAttr (struct::termios *ttmode) const |
Wrapper around tcgetattr(3). More... | |
bool | tcSetAttr (struct::termios *ttmode) |
Wrapper around tcsetattr(3) with mode TCSANOW. More... | |
const char * | ttyName () const |
Protected Member Functions | |
KPty (KPtyPrivate *d) | |
Protected Attributes | |
KPtyPrivate *const | d_ptr |
Provides primitives for opening & closing a pseudo TTY pair, assigning the controlling TTY, utmp registration and setting various terminal attributes.
KPty::~KPty | ( | ) |
|
protected |
Definition at line 202 of file kpty.cpp.
References d_ptr, and KPtyPrivate::q_ptr.
void KPty::close | ( | void | ) |
Close the pty master/slave pair.
Definition at line 405 of file kpty.cpp.
References closeSlave(), d, and stat().
Referenced by closeSlave(), open(), and ~KPty().
void KPty::closeSlave | ( | ) |
Close the pty slave descriptor.
When creating the pty, KPty also opens the slave and keeps it open. Consequently the master will never receive an EOF notification. Usually this is the desired behavior, as a closed pty slave can be reopened any time - unlike a pipe or socket. However, in some cases pipe-alike behavior might be desired.
After this function was called, slaveFd() and setCTty() cannot be used.
Definition at line 395 of file kpty.cpp.
Referenced by close().
int KPty::masterFd | ( | ) | const |
This function should be called only while the pty is open.
Definition at line 481 of file kpty.cpp.
References d.
Referenced by TerminalModel::sendData(), and TerminalModel::TerminalModel().
bool KPty::open | ( | ) |
Create a pty master/slave pair.
Definition at line 214 of file kpty.cpp.
References close(), d, PATH_MAX, stat(), tcGetAttr(), tcSetAttr(), and TTY_GROUP.
Referenced by QUnixTerminalImpl::initialize().
Set whether the pty should echo input.
Echo is on by default. If the output of automatically fed (non-interactive) PTY clients needs to be parsed, disabling echo often makes it much simpler.
This function can be used only while the PTY is open.
echo | true if input should be echoed. |
true
on success, false otherwise Definition at line 462 of file kpty.cpp.
References ECHO, tcGetAttr(), and tcSetAttr().
Change the logical (screen) size of the pty.
The default is 24 lines by 80 columns.
This function can be used only while the PTY is open.
lines | the number of rows |
columns | the number of columns |
true
on success, false otherwise Definition at line 451 of file kpty.cpp.
References d.
Referenced by TerminalModel::updateTerminalSize().
int KPty::slaveFd | ( | ) | const |
This function should be called only while the pty slave is open.
Definition at line 488 of file kpty.cpp.
References d.
Referenced by QUnixTerminalImpl::connectToPty().
bool KPty::tcGetAttr | ( | struct::termios * | ttmode | ) | const |
Wrapper around tcgetattr(3).
This function can be used only while the PTY is open. You will need an #include <termios.h> to do anything useful with it.
ttmode | a pointer to a termios structure. Note: when declaring ttmode, struct ::termios must be used - without the '::' some version of HP-UX thinks, this declares the struct in your class, in your method. |
true
on success, false otherwise Definition at line 437 of file kpty.cpp.
References d.
bool KPty::tcSetAttr | ( | struct::termios * | ttmode | ) |
Wrapper around tcsetattr(3) with mode TCSANOW.
This function can be used only while the PTY is open.
ttmode | a pointer to a termios structure. |
true
on success, false otherwise. Note that success means that at least one attribute could be set. Definition at line 444 of file kpty.cpp.
References d.
const char * KPty::ttyName | ( | ) | const |
|
protected |