Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mit-eddie.UUCP Path: utzoo!linus!decvax!genrad!mit-eddie!mp From: mp@mit-eddie.UUCP (Mark Plotnick) Newsgroups: net.sources Subject: Re: Warp 6.0 Message-ID: <646@mit-eddie.UUCP> Date: Wed, 24-Aug-83 10:00:38 EDT Article-I.D.: mit-eddi.646 Posted: Wed Aug 24 10:00:38 1983 Date-Received: Wed, 24-Aug-83 14:57:40 EDT References: <893@utah-gr.UUCP> Organization: MIT, Cambridge, MA Lines: 52 Here are some suggestions for two of the problems you'll have making warp run on non-Berkeley UNIX. Note that I'm talking about UNIX 3.0.1 here, which is probably the same as System 3. Perhaps you can do things in different ways with System 5. 1) lack of FIONREAD. While you can't get a count of characters waiting to be read, you can set things up so that a read will slurp in all the characters that have been typed ahead. Warp's input_pending macro is used in 3 different ways: once is to read all pending input (this can be replaced by a single read() call), once is to sleep until any character is typed (I'm not sure how to solve this one cleanly), and once to essentially flush all typeahead (which you can do by simply reading until the count==0; perhaps there's an ioctl call that'll do this for you). 2) lack of a simple bit to turn on RAW mode. UNIX 3.0.1 had routines that emulated stty and gtty, but if you use them you'll get bits such as ECHOE turned off when you exit warp. Here's some code I wrote that'll put your tty into RAW mode, with no echo, and with non-blocking reads. #include #include #include fd=open("/dev/tty",O_RDWR+O_NDELAY) struct termio ttyjunk; toraw() { struct termio nttyjunk; ioctl(fd, TCGETA, &ttyjunk); nttyjunk=ttyjunk; nttyjunk.c_iflag = IGNBRK; /* ignore break, no crnl mapping, no ^S^Q */ nttyjunk.c_oflag = 0; /* no delays, no crlf mapping */ nttyjunk.c_lflag &= ~(ISIG|ECHO|ICANON); /* no echo, signals, or erase/kill processing */ nttyjunk.c_cc[VMIN] = 1; /* return after every character read */ nttyjunk.c_cc[VTIME] = 1; ioctl(fd, TCSETAW, &nttyjunk); unraw() { ioctl(fd,TCSETAW, &ttyjunk); }