PROGRAM :
Code:
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcid = "$Id: isatty.c,v 1.1.1.1 2000/02/10 01:00:58 sasha Exp $";
#endif
#include <pthread.h>
#ifdef snos4
#include <sys/termio.h>
#else
#include <termios.h>
#endif
#include <unistd.h>
#ifndef TICGETA
#ifdef TGETATTR
#define TICGETA TGETATTR
#else
#ifndef TGETA
#include <termio.h>
#endif
#ifndef TICGETA
#define TICGETA TGETA
#endif
#endif
#endif
int isatty_basic(int f)
{
#ifdef snos4
struct termi v;
#else
struct termo v;
#endif
return (machdep_sys_ioctl(f,
#ifdef snos4
TGETA,
#else
TICGETA,
#endif
&v) ? 0 : 1);
}
int isatty(int f)
{
int rt;
if ((rt = f_lock(f, FD_READ, NULL)) == OK)
{
rt = isatty_basic(f_table[f]->f.i);
f_unlock(f, FD_READ);
} else
{
rt = 0;
}
return(rt);
}
Bookmarks