#ifndef __REDAKEY_H
#define __READKEY_H

#ifdef	MSDOS			/* sotto dos la funzione getch fa il tutto */

#include <conio.h>
#define	readkey()	getch()

#else				/* sotto UNIX e' una soluzione */

#include <termios.h>
#define	STDIN_FILENO 0

static int 
readkey()
{
	int c;
	struct termios tty, otty;

	tcgetattr(STDIN_FILENO, &otty);
	tty = otty;
	tty.c_lflag &= ~(ECHO | ECHOK | ICANON);
	tty.c_cc[VTIME] = 1;
	tcsetattr(STDIN_FILENO, TCSANOW, &tty);
	c = getchar();
	tcsetattr(STDIN_FILENO, TCSANOW, &otty);
	return (c);
}
#endif

#endif /* __READKEY_H */

