Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!news-server.csri.toronto.edu!me!eastick From: eastick@me.utoronto.ca (Doug Eastick) Newsgroups: comp.lang.perl Subject: my ioctl's don't work Message-ID: <1990Apr11.142002.26192@me.toronto.edu> Date: 11 Apr 90 18:20:03 GMT Distribution: comp Lines: 50 Copyright: none Organisation: U of Toronto, Dept. of Mechanical Engineering I'm trying to get a program to work in cbreak mode. I stole this from someone (Randal, I think). I'm including sys/ioctl.h (after makelib'ing it). The problem lies with the TIOCGETP ioctl: *** Can't ioctl TIOCGETP: Inappropriate ioctl for device at blah line 83. *** The answer is simple, I just don't know what it is :-(. Any help is appreciated. Thanks very much. Specifics: Patchlevel 18 UMIPS-BSD 2.1 (BSD 4.3 like) or SunOS 3.5 (breaks on both) ------- sub cbreak { &set_cbreak(1); } sub cooked { &set_cbreak(0); } sub set_cbreak { local($on) = $_[0]; local($sgttyb); $sgttyb_t = 'C4 S' unless $sgttyb_t; ioctl(STDIN,$TIOCGETP,$sgttyb) || die "Can't ioctl TIOCGETP: $!"; @ary = unpack($sgttyb_t,$sgttyb); if ($on) { $ary[4] |= $CBREAK; $ary[4] &= ~$ECHO; } else { $ary[4] &= ~$CBREAK; $ary[4] |= $ECHO; } $sgttyb = pack($sgttyb_t,@ary); ioctl(STDIN,$TIOCSETP,$sgttyb) || die "Can't ioctl TIOCSETP: $!"; } -- Doug Eastick -- eastick@me.utoronto.ca "I'm going to the backseat of my car with my wife, and I won't be back for TEN MINUTES!" -- Homer Simpson in Jacques to be Wild