Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!amdahl!ems!mark From: mark@ems.MN.ORG (Mark H. Colburn) Newsgroups: comp.sources.bugs Subject: Re: Compress error message -n comp.sources.bugs -f wjc@ho5cad.ATT.COM Message-ID: <667@ems.MN.ORG> Date: Mon, 31-Aug-87 14:36:21 EDT Article-I.D.: ems.667 Posted: Mon Aug 31 14:36:21 1987 Date-Received: Fri, 4-Sep-87 06:26:32 EDT References: <339@cbstr1.att.com> <209@ho7cad.ATT.COM> Reply-To: mark@ems.UUCP (Mark H. Colburn) Organization: EMS/McGraw-Hill, Eden Pairie, MN Lines: 53 In article <209@ho7cad.ATT.COM> nuucp@ho7cad.ATT.COM (UUCP) writes: >In article <339@cbstr1.att.com> Karl.Kleinpaste@cbstr1.att.com writes: >>> This month's "Worst Error Message of the Month Award" goes >>> unconditionally to compress 4.0. >>> Not a typewriter >>> Well, duh! That's right, it's NOT a typewriter. >Well, I agree. This is pretty funny. But don't blame compress. A >lot of programs give you this. Seems to be what you get on some >machines when you call "perror()" when there ain't been no error (of >its genre) [or maybe when the error number is bigger than the secret >message array]. We got this problem from Unipress EMACS as well. The problem is that the program is calling ioctl and attempting to get or set terminal parameters for the input or output file. It would appear that the programs are trying to be generic by getting or setting terminal parameters on any file that they do i/o from. However, In the case where the input or output file is not a terminal, ioctl will return the above error. Specifically, the error will be generated if you attempt to read or write the terminal settings when the target file is not a terminal. For example (this code is for System V.2, Berkley may be different): struct termio cb; int fd; if(ioctl(fd, TCGETA, &cb) == -1) { perror(NULL); /* die with a "Not a typewriter" error */ } else { ... do some stuff ... } This is easily worked around (if you have source to the package which is causing you a problem) by adding a isatty() before the offending ioctl.. struct termio cb; int fd; if (isatty(fd) { if(ioctl(fd, TCGETA, &cb) == -1) { perror(NULL); /* die with a "Not a typewriter" error */ } else { /* ... do some stuff ... */ } } else { /* handle a regular file (probably do nothing) */ } Hope that this helps! -- Mark H. Colburn DOMAIN: mark@ems.MN.ORG EMS/McGraw-Hill UUCP: ihnp4!meccts!ems!mark AT&T: (612) 829-8200