4.3BSD-UWisc/man/cat3/xtty.3x




XTTY(3X)            UNIX Programmer's Manual             XTTY(3X)



NAME
     Xtty - routines to provide terminal emulator windows

SYNOPSIS
     #include <X/Xlib.h>
     #include <X/Xtty.h>

     TTYWindow *CreateTTYWindow(cols, lines, x, y, normalFont,
     boldFont, bwidth, reverse)
     int cols, lines, x, y, bwidth, reverse;
     char *normalFont, *boldFont;

     DestroyTTYWindow(t);
     TTYWindow *t;

     TTYPutString(t, str);
     TTYWindow *t;
     char *str;

     TTYPutChar(t, ch);
     TTYWindow *t;
     char ch;

     TTYPrintf(t, format [ , arg ] ... )
     TTYWindow *t;
     char *format;

     char *TTYGetString(t, string, n)
     TTYWindow *t;
     char *string;
     int n;

     int TTYGetChar(t)
     TTYWindow *t;

     SetStdout(t)
     TTYWindow *t;

     ResetStdout()

DESCRIPTION
     These functions allow applications to create terminal emula-
     tor windows.  The windows are managed by creating a subpro-
     cess _x_t_e_r_m(_1) and communicating with it through a pty.  The
     _T_T_Y_W_i_n_d_o_w data structure is defined in <_X/_X_t_t_y._h>:

     typedef struct _TTYWindow {
          Window w;      /* The window id */
          int pid;       /* The pid of the subprocess xterm */
          short file;         /* The file id to read and write characters
                            characters to/from */
     } TTYWindow;



Printed 1/10/87          28 January 1985                        1






XTTY(3X)            UNIX Programmer's Manual             XTTY(3X)



     _C_r_e_a_t_e_T_T_Y_W_i_n_d_o_w creates a window that is _c_o_l_s characters
     wide and _l_i_n_e_s characters high.  It is located with its
     upper left hand corner located at the point _x, _y in the root
     window.  The border is _b_w_i_d_t_h pixels wide.  Normal text is
     displayed in _n_o_r_m_a_l_F_o_n_t and boldface text is displayed in
     _b_o_l_d_F_o_n_t. If _b_o_l_d_F_o_n_t is NULL, the normal font is used for
     both.  If _r_e_v_e_r_s_e is non-zero, the window is created in
     reverse-video.

     The new window is created and mapped to the screen, and emu-
     lates a DEC VT102 terminal precisely as well as _x_t_e_r_m(_1)
     does.

     _D_e_s_t_r_o_y_T_T_Y_W_i_n_d_o_w destroys the window described by its argu-
     ment.  The window is also destroyed if the creating process
     terminates or is killed.  See the BUGS section, below.

     _T_T_Y_P_u_t_S_t_r_i_n_g prints its string in its window.  An applica-
     tion may instead wish to use the _f_i_l_e field of the _T_T_Y_W_i_n_d_o_w
     directly.

     _T_T_Y_P_u_t_C_h_a_r is similar to _T_e_x_t_P_u_t_S_t_r_i_n_g but only prints a
     single character.

     _T_T_Y_P_r_i_n_t_f is similar to the standard function _p_r_i_n_t_f except
     that it prints its result in the specified window.  The
     resulting string is passed to _T_T_Y_P_u_t_S_t_r_i_n_g. See also the
     BUGS section, below.

     _T_T_Y_G_e_t_S_t_r_i_n_g fills the array _s_t_r_i_n_g with at most _n charac-
     ters.  _T_T_Y_G_e_t_S_t_r_i_n_g will also return before _n characters are
     read if a newline (\n) is encountered.  An application may
     instead wish to use the _f_i_l_e field of the _T_T_Y_W_i_n_d_o_w
     directly.

     _T_T_Y_G_e_t_C_h_a_r returns one character from the window.

     _S_e_t_S_t_d_o_u_t sets things up so that the standard I/O routines
     which write to stdout will write to the window instead.
     This is particularly useful with the _c_u_r_s_e_s(_3_X) package
     since it always writes to stdout.

     _R_e_s_e_t_S_t_d_o_u_t resets stdout to its original value.

SEE ALSO
     printf(3S), xterm(1), Xtext(3X), curses(3X), X(8C)

AUTHOR
     Paul Asente, Stanford University

BUGS
     _T_T_Y_P_r_i_n_t_f truncates its output if the resulting string is



Printed 1/10/87          28 January 1985                        2






XTTY(3X)            UNIX Programmer's Manual             XTTY(3X)



     more than 2048 characters long.

     It is impossible to make one implementation that works
     correctly for both monochrome and color displays since you
     cannot specify colors on a monochrome display and reverse-
     video doesn't make much sense on a color display.  This ver-
     sion works for monochrome displays.
















































Printed 1/10/87          28 January 1985                        3