9 date 92.02.03.17.57.22; author jromine; state Exp;
14 date 92.02.03.16.36.16; author jromine; state Exp;
19 date 90.04.05.15.03.23; author sources; state Exp;
24 date 90.03.12.10.24.37; author sources; state Exp;
29 date 90.02.09.11.08.37; author sources; state Exp;
34 date 90.02.09.11.07.39; author sources; state Exp;
48 @/* ttym.c - miscellaneous routines */
50 static char ident[] = "@@(#)$Id: ttym.c,v 1.5 1992/02/03 16:36:16 jromine Exp jromine $";
63 static ttym (fd, command, line, user, vec)
80 struct passwd *getpwuid ();
82 #endif /* !__STDC__ */
84 if ((term = ap = ttyname (2)) && (term = rindex (term, '/')))
86 if (term == NULL || *term == NULL)
88 if ((myself = getlogin ()) == NULL || *myself == NULL)
89 myself = (pw = getpwuid (getuid ())) ? pw -> pw_name : NULL;
91 pstat = signal (SIGPIPE, SIG_IGN);
92 (void) write (fd, command, strlen (command));
93 (void) write (fd, "", 1);
96 (void) write (fd, term, strlen (term));
97 (void) write (fd, "", 1);
100 (void) write (fd, myself, strlen (myself));
101 (void) write (fd, "", 1);
104 (void) write (fd, line, strlen (line));
105 (void) write (fd, "", 1);
108 (void) write (fd, user, strlen (user));
109 (void) write (fd, "", 1);
112 while (ap = *vec++) {
113 (void) write (fd, ap, strlen (ap));
114 (void) write (fd, "", 1);
117 (void) write (fd, "", 1);
118 (void) signal (SIGPIPE, pstat);
132 nbits = getdtablesize();
135 if (select (nbits, &ifds, (int *) 0, (int *) 0, &tv) <= 0
136 || read (fd, &c, 1) != 1)
142 (void) ttyf (fd, stderr);
147 static int ttyf (fd, f)
154 while ((i = read (fd, buffer, sizeof buffer)) > 0)
155 (void) fwrite (buffer, sizeof (char), i, f);
168 static char ident[] = "@@(#)$Id: ttym.c,v 1.4 1990/04/05 15:03:23 sources Exp jromine $";
181 static char ident[] = "@@(#)$Id:$";