[comp.sources.bugs] Compress error message -n comp.sources.bugs -f wjc@ho5cad.ATT.COM

nuucp@ho7cad.ATT.COM (UUCP) (08/25/87)

Posting-Front-End: GNU Emacs 18.47.1 of Fri Jun 26 1987 on ho5cad (usg-unix-v)


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.  It's a binary
>>  executable, suitable for exec'ing.
>>
>>  Lovely, just lovely.

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].

Better than your message  from compress, we get  it from sendmail when
it can't find somebody or some machine:

	503 cbstr1: not a typewriter
	602 karl: not a typewriter

Usually,  when I see   one of these  about somebody   I know or  their
machine, I  forward it   to them so   that  they know  they're  not  a
typewriter.  Here's one for you.

	Bill Carpenter
	(AT&T gateways)!ho5cad!wjc
	HO 1L-410, (201)949-8392

PS:- If you actually  happen to be a  typewriter, my apologies for the
above cruel remarks. :-}

mark@ems.MN.ORG (Mark H. Colburn) (08/31/87)

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