marekp@contact.UUCP (Marek Pawlowski) (06/26/90)
Here's a routine for Unix that I whipped up (with a little help from my
friends). You can be smary enough to figure it out.
#include <signal.h>
#include <sgtty.h>
struct sgttyb save_tty;
/* for timeout -- restore tty and exit */
alarm_handler()
{
stty(0, &save_tty);
exit(1);
}
main(){
struct sgttyb mytty;
char c;
gtty(0, &mytty);
save_tty = mytty;
mytty.sg_flags |= (RAW);
stty(0, &mytty);
signal(SIGALRM,alarm_handler);
alarm(5); /* time out after 5 seconds */
/* get 1 character and output it */
read(0, &c, 1);
write(1, &c, 1);
/* Restore the tty settings */
stty(0, &save_tty);
exit(0);
}
Also, if anyone in PA, knows good Apple dealers (around Scranton preferably),
could you mail me as soon and QUICKLY as possible, with maybe a phone number,
and address? I'm going there in a few days, and want to do some Hardware
shopping.. Thanks..