Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site rochester.UUCP Path: utzoo!linus!decvax!harpo!floyd!cmcl2!philabs!seismo!rochester!jay From: jay@rochester.UUCP (Jay Weber) Newsgroups: net.micro.pc Subject: Re: DOS 2.0 Problems Message-ID: <3305@rochester.UUCP> Date: Fri, 7-Oct-83 20:24:23 EDT Article-I.D.: rocheste.3305 Posted: Fri Oct 7 20:24:23 1983 Date-Received: Sun, 9-Oct-83 19:03:52 EDT References: <118@shell.UUCP> Organization: U. of Rochester, CS Dept. Lines: 33 In reference to the complaint about CiC86 programs hanging when you redirect the input: That is due to the C library interacting with DOS 2.0. The function call used in ascii mode is "buffered keyboard input with echo". The echo part is why you see the file printing on the screen whether you printed it or not. The system call gets the redirected character from the file, thinking it is from the keyboard, and through ignorance, echoes it. Aha! You say, why not use the "no echo" call(s)? Well, then it won't work correctly when typing from the keyboard. You could do an ioctl function call to find if the input is the console and act accordingly, but it is probably better and possibly easier to just rewrite the library routines to do the new 2.0 calls. I have done some of this. When I come up with a universally usable set of new routines, I'll post them. The reason why it hangs is because the keyboard input system call reads until a newline character is fetched; when you redirect the input, the last character sent is a ^Z -- what you see on the screen is the ^Z echoed, and it is waiting for a newline that you cannot give. Frustrating, since it is inside a system call "never to return", so you cannot BREAK it. Rebooting is the only thing to do. A quick fix might be to change the library routines to not use the buffered system calls. By the way, I wrote a very tiny but handy c routine, called safe(). All it does is check to see if there is a character on the input, discard the result, and return. What it does is allow you to BREAK out of infinite loops if a call to safe() is inside the loop. Helps out alot in debugging, becasue I hate rebooting when. I screw something up. -Jay Weber {jay@rochester, ..!seismo!rochester!jay}