Ejemplo n.º 1
0
int
isatty(int f)
{
    struct sgbuf sgbuf;

    if(_gs_opt(f, &sgbuf) < 0) return -1;
    return sgbuf.sg_class == 0;
}
Ejemplo n.º 2
0
void initscr()
{
	/* make sure TERM variable is set */
#if MSDOS
	char *val;
	if (! (val = getenv("TERM"))
	|| !strcmp(val, "pcbios"))
#else
	if (!getenv("TERM"))
#endif
	{
#if ANY_UNIX
		write(2, "Environment variable TERM must be set\n", (unsigned)38);
		exit(1);
#endif
#if OSK
		writeln(2, "Environment variable TERM must be set\n", (unsigned)38);
		exit(1);
#endif
#if MSDOS || TOS
		getsize(0);
#endif
	}
	else
	{
#if MSDOS
		*o_pcbios=0;
#endif
		/* start termcap stuff */
		starttcap();
	}

	/* create stdscr and curscr */
	stdscr = kbuf;

	/* change the terminal mode to cbreak/noecho */
#if ANY_UNIX
# if UNIXV
	/*ioctl(2, TCGETS, &oldtermios);*/
	tcgetattr(2, &oldtermios);
# else
	ioctl(2, TIOCGETP, &oldsgttyb);
# endif
#endif

#if OSK
	_gs_opt(0, &oldsgttyb);
#endif
	resume_curses(TRUE);
}
Ejemplo n.º 3
0
/* Initialize the Curses package. */
void initscr()
{
	/* make sure TERM variable is set */
	termtype = getenv("TERM");

#if VMS
	/* VMS getenv() handles TERM as a environment setting.  Foreign 
	 * terminal support can be implemented by setting the ELVIS_TERM
	 * logical or symbol to match a tinytcap entry.
	 */
	if (!strcmp(termtype,"unknown"))
		termtype = getenv("ELVIS_TERM");
#endif
#if MSDOS
	/* For MS-DOS, if TERM is unset we can default to "pcbios", or
	 * maybe "rainbow".
	 */
	if (!termtype)
	{
#ifdef RAINBOW
		if (*(unsigned char far*)(0xffff000eL) == 6   /* Rainbow 100a */
		 || *(unsigned char far*)(0xffff000eL) == 148)/* Rainbow 100b */
		{
			termtype = "rainbow";
		}
		else
#endif
			termtype = "pcbios";
	}
	if (!strcmp(termtype, "pcbios"))
#else
	if (!termtype)
#endif
	{
#if ANY_UNIX
		write(2, "Environment variable TERM must be set\n", (unsigned)38);
		exit(1);
#endif
#if OSK
		writeln(2, "Environment variable TERM must be set\n", (unsigned)38);
		exit(1);
#endif
#if AMIGA
		termtype = TERMTYPE;
		starttcap(termtype);
#endif
#if MSDOS
		starttcap("pcbios");
#endif
#if TOS
		termtype = "vt52";
		starttcap(termtype);
#endif
#if VMS
		write(2, "UNKNOWN terminal: define ELVIS_TERM\n", (unsigned)36);
		exit(1);
#endif
	}
	else
	{
#if MSDOS
		*o_pcbios = 0;
#endif
		/* start termcap stuff */
		starttcap(termtype);
	}

	/* create stdscr and curscr */
	stdscr = kbuf;

	/* change the terminal mode to cbreak/noecho */
#if ANY_UNIX
	tcgetattr(2, &oldtermio);
#endif

#if OSK
	_gs_opt(0, &oldsgttyb);
#endif

#if VMS
	VMS_read_raw = 1;   /* cbreak/noecho */
	vms_open_tty();
#endif
	resume_curses(TRUE);
}