tholm@uvicctr.UUCP (Terrence W. Holm) (08/26/88)
[SORRY, SOME OF YOU WILL GET THIS TWICE. THE NET WAS BROKEN SOMEWHERE, SO WE REPOSTED A FEW OF THE REPORTS.] EFTH MINIX report #31 - August 1988 - ctermid(3) There follows an implementation of ctermid(3) for Minix. Please consider this public domain software. A "man" page is included. ---------------------------------------------------------- echo x - ctermid.3 gres '^X' '' > ctermid.3 << '/' XSUBROUTINES X ctermid(3) - name of controlling terminal X XINVOCATION X #include <stdio.h> X X char *ctermid( name_space ) X char *name_space; X XEXPLANATION X Ctermid(3) returns a pointer to a string naming the controlling X terminal. If <name_space> is NULL then local static storage X is used, otherwise <name_space> must point to storage of at X least L_ctermid characters. X XRESULTS X A pointer to "/dev/tty". X XREFERENCES X ttyname(3) / echo x - ctermid.c gres '^X' '' > ctermid.c << '/' X/* ctermid(3) X * X * Author: Terrence Holm Aug. 1988 X * X * X * Ctermid(3) returns a pointer to a string naming the controlling X * terminal. If <name_space> is NULL then local static storage X * is used, otherwise <name_space> must point to storage of at X * least L_ctermid characters. X * X * Returns a pointer to "/dev/tty". X */ X X#include <stdio.h> X X#ifndef L_ctermid X#define L_ctermid 9 X#endif X X Xchar *ctermid( name_space ) X char *name_space; X X { X static char termid[ L_ctermid ]; X X if ( name_space == NULL ) X name_space = termid; X X strcpy( name_space, "/dev/tty" ); X X return( name_space ); X } / ---------------------------------------------------------- Edwin L. Froese uw-beaver!ubc-cs!mprg!handel!froese Terrence W. Holm uw-beaver!uvicctr!tholm