/*
 * Routines specific to Aztec C.
 */

#include "news.h"
#include <sgtty.h>
#include <fcntl.h>

/*
 * put the console into raw or cooked mode
 */

raw(FILE *f)
{
	struct sgttyb ttyinfo;

	if (ioctl(fileno(f), TIOCGETP, &ttyinfo) < 0) return -1;
	ttyinfo.sg_flags |= RAW;
	if (ioctl(fileno(f), TIOCSETP, &ttyinfo) < 0) return -1;
	return 0;
}

cooked(FILE *f)
{
	struct sgttyb ttyinfo;

	if (ioctl(fileno(f), TIOCGETP, &ttyinfo) < 0) return -1;
	ttyinfo.sg_flags &= ~RAW;
	if (ioctl(fileno(f), TIOCSETP, &ttyinfo) < 0) return -1;
	return 0;
}
