pty

Name

pty -- Functions for starting a new process on a new pseudo-terminal and for manipulating psuedo-terminals.

Synopsis



int         vte_pty_open                    (pid_t *child,
                                             char **env_add,
                                             const char *command,
                                             char **argv,
                                             int columns,
                                             int rows);
int         vte_pty_get_size                (int master,
                                             int *columns,
                                             int *rows);
int         vte_pty_set_size                (int master,
                                             int columns,
                                             int rows);

Description

The terminal widget uses these functions to start commands with new controlling pseudo-terminals and to resize psuedo-terminals.

Details

vte_pty_open ()

int         vte_pty_open                    (pid_t *child,
                                             char **env_add,
                                             const char *command,
                                             char **argv,
                                             int columns,
                                             int rows);

Starts a new copy of command running under a psuedo-terminal, with window size set to rows x columns and variables in env_add added to its environment.

child : location to store the new process's ID
env_add : a list of environment variables to add to the child's environment
command : name of the binary to run
argv : arguments to pass to command
columns : desired window columns
rows : desired window rows
Returns : an open file descriptor for the pty master, -1 on failure


vte_pty_get_size ()

int         vte_pty_get_size                (int master,
                                             int *columns,
                                             int *rows);

Attempts to read the pseudo terminal's window size.

master : the file descriptor of the pty master
columns : a place to store the number of columns
rows : a place to store the number of rows
Returns : 0 on success, -1 on failure.


vte_pty_set_size ()

int         vte_pty_set_size                (int master,
                                             int columns,
                                             int rows);

Attempts to resize the pseudo terminal's window size. If successful, the OS kernel will send SIGWINCH to the child process group.

master : the file descriptor of the pty master
columns : the desired number of columns
rows : the desired number of rows
Returns : 0 on success, -1 on failure.