Date: Thu, 24 Sep 1998 19:24:20 +0300 (IDT) From: Eli Zaretskii To: nonsuch2000 AT my-dejanews DOT com cc: djgpp AT delorie DOT com Subject: Re: Reading stdin with Zip, GZIP, etc In-Reply-To: <6u54gb$9gm$1@nnrp1.dejanews.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 21 Sep 1998 nonsuch2000 AT my-dejanews DOT com wrote: > Does anyone know why/how to fix a problem which affects some DJGPP > compiled programs such and Zip and Gzip when reading from stdin? > > Doing something like zip foo - > or gzip -f > > hangs the machine. This is most probably a bug in the ports of these programs. The program does not hang the machine, btw, it just reads from stdin forever, and doesn't echo anything you type, so it just seems to hang. Any DJGPP program that switches the console device to binary mode and then tries to read from stdin cannot be interrupted, and you cannot signal an EOF to it, since the console is switched into raw mode where ^Z is just another character. The right way is to test whether stdin is the console (with a call to isatty) and only switch it to binary mode if it's not. Since I just happen to work on a new port of Gzip (talk about coincidence ;-), I will make sure this bug doesn't happen there. I already spotted this problem in the sources, but thanks for providing me with a real-life test case. For Zip, please write to the maintainers of the Zip/UnZip project (should be somewhere in the READMEs). Or just grab the sources, correct the bug and recompile. If you have any other DJGPP programs that behave this way, please name them.