home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / sps / part1 / findtty.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  505 b   |  22 lines

  1. # include       "sps.h"
  2. # include       <h/tty.h>
  3.  
  4. /* FINDTTY - Attempts to determine to which tty a process is connected */
  5. struct ttyline  *findtty ( p )
  6.  
  7. register struct process         *p ;
  8.  
  9. {
  10.     register struct ttyline *lp ;
  11.     extern struct info      Info ;
  12.     extern struct ttyline   Notty ;
  13.     extern union userstate  User ;
  14.  
  15.     if ( !p->pr_p.p_pgrp )
  16.         return ( &Notty ) ;
  17.     for ( lp = Info.i_ttyline ; lp->l_name[0] ; lp++ )
  18.         if ( lp->l_dev == User.u_us.u_ttyd )
  19.             return ( lp ) ;
  20.     return ( &Notty ) ;
  21. }
  22.