Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ xtty(3X) — Ultrix WS 1.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

printf(3S)

xterm(1)

Xtext(3X)

curses(3X)

X(8C)

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 emulator windows.  The windows are managed by creating a subprocess xterm(1) and communicating with it through a pty.  The TTYWindow data structure is defined in <X/Xtty.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;

CreateTTYWindow creates a window that is cols characters wide and lines characters high.  It is located with its upper left hand corner located at the point x, y in the root window.  The border is bwidth pixels wide.  Normal text is displayed in normalFont and boldface text is displayed in boldFont.  If boldFont is NULL, the normal font is used for both.  If reverse is non-zero, the window is created in reverse-video. 

The new window is created and mapped to the screen, and emulates a DEC VT102 terminal precisely as well as xterm(1) does. 

DestroyTTYWindow destroys the window described by its argument.  The window is also destroyed if the creating process terminates or is killed.  See the BUGS section, below. 

TTYPutString prints its string in its window.  An application may instead wish to use the file field of the TTYWindow directly. 

TTYPutChar is similar to TextPutString but only prints a single character. 

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

TTYGetString fills the array string with at most n characters.  TTYGetString will also return before n characters are read if a newline (\n) is encountered.  An application may instead wish to use the file field of the TTYWindow directly. 

TTYGetChar returns one character from the window. 

SetStdout 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 curses(3X) package since it always writes to stdout. 

ResetStdout resets stdout to its original value. 

SEE ALSO

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

AUTHOR

Paul Asente, Stanford University

BUGS

TTYPrintf truncates its output if the resulting string is 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 version works for monochrome displays. 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026