# class KPty

###

Table of contents
Modules
kdecore Classes
All Classes

Module | kdecore
Namespace | global
Class | KPty
Inherits |

Internal Provides primitives for opening & closing a pseudo TTY pair, assigning the controlling TTY, utmp registration and setting various terminal attributes.

### methods

- KPty ()

  returns a KPty object

  Constructor

- KPty (d)

  returns a KPty object
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  d | KPtyPrivate |

  Internal

- close ()

  returns nothing

  Close the pty master/slave pair.

- closeSlave ()

  returns nothing

  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.

- login (user, remotehost)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  user | char | 0
  remotehost | char | 0

  Creates an utmp entry for the tty. This function must be called after calling setCTty and making this pty the stdin.

  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.

- logout ()

  returns nothing

  Removes the utmp entry for this tty.

- masterFd ()

  returns (int)

  Returns the file descriptor of the master pty

  This function should be called only while the pty is open.

- open ()

  returns (bool)

  Create a pty master/slave pair.

  Returns true if a pty pair was successfully opened

- setCTty ()

  returns nothing

  Creates a new session and process group and makes this pty the controlling tty.

- setEcho (echo)

  returns (bool)

  Argument | Type | Default
  --- | --- | ---
  echo | bool |

  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. Returns true on success, false otherwise

- setWinSize (lines, columns)

  returns (bool)

  Argument | Type | Default
  --- | --- | ---
  lines | int |
  columns | int |

  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 Returns true on success, false otherwise

- slaveFd ()

  returns (int)

  Returns the file descriptor of the slave pty

  This function should be called only while the pty slave is open.

- tcGetAttr (ttmode)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  ttmode | termios |

  Wrapper around tcgetattr(3).

  This function can be used only while the PTY is open. #include <termios.h> to do anything useful with it.

  ttmode - a pointer to a termios structure. Note: when declaring ttmode, 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

- tcSetAttr (ttmode)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  ttmode | termios |

  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. Returns true on success, false otherwise. Note that success means that at least one attribute could be set.

- ttyName ()

  returns (char)

  Returns the name of the slave pty device.

  This function should be called only while the pty is open.