Xref: utzoo comp.unix.questions:29360 gnu.gcc.help:514 Path: utzoo!news-server.csri.toronto.edu!rutgers!bionet!snorkelwacker.mit.edu!ai-lab!ai.mit.edu!gnulists From: sono!mayer@sun.com (Ronald &) Newsgroups: comp.unix.questions,gnu.gcc.help Subject: ioctl TIOCSTI question Message-ID: Date: 11 Mar 91 18:48:08 GMT Followup-To: comp.unix.questions Organization: Acuson; Mountain View, California Lines: 57 Approved: info-gnu@prep.ai.mit.edu To: gnu-gcc-announce@uunet.uu.net On a sparcstation, SunOS 4.1 I am having a problem using the termio ioctl TIOCSTI [simulate terminal input] when using gcc. While it works as expected under cc, under gcc I get an "Inappropriate ioctl for device" error message. Any ideas what I'm missing? Ron Mayer sun!sono!mayer mayer@sono.uucp [A (short) example program and OS/system info follows:] % cat ioc.c /* This program works differently under gcc and cc. Why? */ #include #include #include #include main() { char a; int fd=open("/dev/tty",O_RDWR); int ioctl_return; if (fd == -1) perror(NULL); a='l'; ioctl(fd,TIOCSTI,&a); /* should send characters as if typed to the tty*/ a='s'; ioctl(fd,TIOCSTI,&a); a='\n'; ioctl_return = ioctl(fd,TIOCSTI,&a); if (ioctl_return == -1) perror(NULL); } % % cc ioc.c % a.out ls % ls [Note: The program "typed" this command] a.out ice.lst ioc.c vhdl % % % gcc ioc.c % a.out Inappropriate ioctl for device % % % % more /etc/motd SunOS Release 4.1 (STANDALONE_1.2) #1: Wed Jul 25 00:05:22 PDT 1990 % arch -k sun4c %