MAN page from RedHat Other XITE-3.3-3.i386.rpm
XPTY
Section: C Library Functions (3)
Updated: 16 Mar 1998
Index
NAME
XptyInit, XptyMessage, XptyStartProgram, XptyClose, XptyKill,XptyJobs, XptyList - Start and stop child process to executejobs
SYNTAX
#include <
xite/Xpty.h>
int XptyInit( Display *display,
int screenno, Widget parent );
int XptyStartProgram( char *entry, char *vec[],
int shell, ptyfunc1 openfunc,
ptyfunc1 closefunc, ptyfunc2 stdoutfunc,
ptyfunc2 stderrfunc, ptyfunc1 imgfunc );
void XptyMessage( program* prog, char* txt );
int XptyJobs( void );
void XptyClose( program *prog, int pipe, int typ );
void XptyKill( program *prog );
void XptyList( Widget wid, XtPointer c_data,
XtPointer call_data );
DESCRIPTION
XptyInitprepares for getting ptys. A popup menu isinitialized with two entries, one labeled "Save Buffer", theother labeled "Kill Window". The callback function for thesemenu entries will execute the indicated action, usingXawAsciiSaveAsFileor XtDestroyWidgetrespectively. Thismenu should be used for AsciiText windows.
Also, XptyInitinstalls an action function AsciiSend for theapplication referenced by parent.
XptyStartPrograminitializes a progstructure. If"<infile>" occurs in vec,a pipe is opened for communicatingan image from the process calling XptyStartProgramto thechild process given by vec[0]. If "<outfile>" occurs invec,a pipe is opened for communicating an image from thechild process indicated by vec[0] to the process callingXtpyStartProgram.The strings "<infile>" and "<outfile>" invecare replaced by the negative of the file-descriptorsopened. The BIFF read- and write-routines (and thus most XITEprograms) will use these file-descriptors for reading andwriting images. An additional pipe is opened for text errormessages.
XptyStartProgramallocates a pty (pseudo terminal) (eitherby calling system function _getpty(if source is compiledwith GETPTY defined)) or by trying to open devices /dev/ptyxy(master) and /dev/ttyxy (slave) (where "x" is one of thecharacters "pqrstuvwxyz", "y" is one of the characters"0123456789abcdef"). If successful, forks out a child processto execute the command in vec.The child process will usethe slave half of the pty for its stdout, and the text errormessage pipe for its stderr. Output images will be sent intoimage pipes. The parent process registers input event sourceswith the X Toolkit Intrinsics, to wait for input from themaster half of the pty (child's stdout), from the text errormessage pipe (child's stderr) and from image pipes.
XptyMessageuses the widget referred to by prog->wid, orif this is NULL, opens an AsciiText widget (shell created withCreatePopTopShell)with size 80x24 characters in thewidget's font. A text indicating the job number and job nameis written to the widget, followed by txt.
The following translation binding is installed by XptyMessagein the AsciiText widget (if prog->wid was NULL upon entry):
Shift <Btn2Down>: PopupMenu(subjobmenu)
<Key>: AsciiSend(<a>, <b>)
where <a> is the job-number, <b> is the channel output-number.subjobmenuis the name of the menu initialized by XptyInit.
The AsciiSendaction function (installed by XptyInit)interprets the key events "q" and "Q" as commands to kill thewidget.
XptyJobsreturns the number of jobs started byXptyStartProgram,and not yet stopped by XptyCloseorXptyKill.
XptyClosecloses pipeand calls prog->closfunc.typisnot used. If no more pipes are open for prog,then write amessage (with XptyMessage)telling that job is terminated.
XptyKillkills (using the system function kill)theprocess indicated by prog,and decrements the count of activeprocesses. With progequal to NULL, kill all processesstarted by XptyStartProgramand set the active process-countequal to zero.
XptyListprints a list of the active processes (started byXptyStartProgram),using the Message(3)function.
SEE ALSO
Message(3)
AUTHOR
Otto Milvang
DOC
Svein Bøe
Index
- NAME
- SYNTAX
- DESCRIPTION
- SEE ALSO
- AUTHOR
- DOC
This document was created byman2html,using the manual pages.