KPty
#include <kpty.h>
Public Member Functions | |
KPty () | |
~KPty () | |
void | close () |
void | closeSlave () |
void | login (const char *user=0, const char *remotehost=0) |
void | logout () |
int | masterFd () const |
bool | open () |
bool | open (int fd) |
bool | openSlave () |
void | setCTty () |
bool | setEcho (bool echo) |
bool | setWinSize (int lines, int columns) |
int | slaveFd () const |
bool | tcGetAttr (struct::termios *ttmode) const |
bool | tcSetAttr (struct::termios *ttmode) |
const char * | ttyName () const |
Protected Member Functions | |
KPty (KPtyPrivate *d) | |
Protected Attributes | |
KPtyPrivate *const | d_ptr |
Detailed Description
Provides primitives for opening & closing a pseudo TTY pair, assigning the controlling TTY, utmp registration and setting various terminal attributes.
Constructor & Destructor Documentation
KPty::~KPty | ( | ) |
|
protected |
Member Function Documentation
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.
void KPty::login | ( | const char * | user = 0 , |
const char * | remotehost = 0 |
||
) |
Creates an utmp entry for the tty.
This function must be called after calling setCTty and making this pty the stdin.
- Parameters
-
user the user to be logged on remotehost the host from which the login is coming. This is not the local host. For remote logins it should be the hostname of the client. For local logins from inside an X session it should be the name of the X display. Otherwise it should be empty.
int KPty::masterFd | ( | ) | const |
bool KPty::open | ( | ) |
bool KPty::open | ( | int | fd | ) |
bool KPty::openSlave | ( | ) |
Open the pty slave descriptor.
This undoes the effect of closeSlave().
- Returns
- true if the pty slave was successfully opened
void KPty::setCTty | ( | ) |
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.
- Parameters
-
echo true if input should be echoed.
- Returns
true
on success, false otherwise
bool KPty::setWinSize | ( | int | lines, |
int | columns | ||
) |
int KPty::slaveFd | ( | ) | const |
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.
- Parameters
-
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.
- Returns
true
on success, false otherwise
bool KPty::tcSetAttr | ( | struct::termios * | ttmode | ) |
const char * KPty::ttyName | ( | ) | const |
Member Data Documentation
|
protected |
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.