Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!maverick.ksu.ksu.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!decwrl!public!pke From: pke@public.BTR.COM (Peter Espen pke@btr.com) Newsgroups: comp.unix.aux Subject: ioctl problem in A/UX 2.0 Keywords: AUX, 2.0, ioctl, help Message-ID: <2041@public.BTR.COM> Date: 8 Mar 91 18:12:11 GMT Distribution: usa Organization: BTR Public Access UNIX, MtnView CA, Contact: cs@btr.com 415-966-1429 Lines: 70 Can someone explain to me why the first ioctl call in the following test program fails with an invalid argument error? I am running A/UX 2.0. /***********************************************/ #define _SYSV_SOURCE #include #include #include #include extern int errno; int fp; char *c_on = "TEST OUTPUT"; char *name = "/dev/tty0"; main () { ttyout ( ); } ttyout( ) { int i, tt; struct termio my_termio; char *buf; if ((fp = open( name, O_RDWR | O_NDELAY)) == NULL) { printf("error opening /dev/tty0"); exit(0); } if ( (i = ioctl( fp, TCGETA, &my_termio)) < 0) { perror("TCGETA:"); fprintf(stderr, "%d: ioctl error on TCGETA op. \n", errno); exit(0); } my_termio.c_cflag |= B9600; if ( (i = ioctl( fp, TCSETA, &my_termio)) < 0) { fprintf(stderr, "ioctl error on TCSETA operation. \n"); exit(0); } buf = c_on; if (fputs(buf, fp) == NULL) fprintf(stderr, "can't fprintf to %s\n", name); else return; close(fp); } /************************************************/ Thanks, Peter Espen pke@btr.com peter@sophia.com