[mod.computers.ridge] BUG in error return from ioctl

bogstad@HOPKINS-EECS-BRAVO.ARPA.UUCP (07/11/86)

	The following program demonstrates a bug in the ioctl() support
for ROS 3.3 update 3.  When compiled and run normally it prints "worked"
to the terminal.  When run with standard output redirected to a file -
"foo > file" - an error message is reported by the ioctl() as expected.
Unfortunately the error message is #14, "Bad address" rather then the
correct #25, "Not a typewriter".

				Bill Bogstad
				bogstad@hopkins-eecs-bravo.arpa

P.S.  If somebody at Ridge is reading this please consider this
	a request for an SPR.

---cut here---

#include <stdio.h>
#include <termio.h>

char *progname;
extern int errno;

main(argc, argv)
int argc;
char *argv[];
{
	struct termio old;

	progname = *argv;

	if(ioctl(1, TCGETA, &old) == -1) {
		fprintf(stderr, "errno = %d\n", errno);
		perror(progname);
 		exit(1);
 	}

	printf("worked\n");

	exit(0);
}