14050Sdlw /* 2*23032Skre * Copyright (c) 1980 Regents of the University of California. 3*23032Skre * All rights reserved. The Berkeley software License Agreement 4*23032Skre * specifies the terms and conditions for redistribution. 54050Sdlw * 6*23032Skre * @(#)isatty_.c 5.1 06/07/85 7*23032Skre */ 8*23032Skre 9*23032Skre /* 104050Sdlw * determine if stream is associated with a tty (async port) 114050Sdlw * 124050Sdlw * calling sequence: 134050Sdlw * logical isatty, val 144050Sdlw * val = isatty (lunit) 154050Sdlw * where: 164050Sdlw * val will be .TRUE. if lunit is associated with a 'tty' 174050Sdlw */ 184050Sdlw 194050Sdlw #include "../libI77/fiodefs.h" 204050Sdlw 214050Sdlw extern unit units[]; /* logical units table from iolib */ 224050Sdlw 234050Sdlw long isatty_(u) 244050Sdlw long *u; 254050Sdlw { 264050Sdlw int i; 274050Sdlw unit *lu; 284050Sdlw 294050Sdlw if (*u < 0 || *u >= MXUNIT) 304050Sdlw return(0); 314050Sdlw lu = &units[*u]; 324050Sdlw if (!lu->ufd) 334050Sdlw return(0); 344050Sdlw return((long)(isatty(fileno(lu->ufd)) != 0)); 354050Sdlw } 36