[comp.lang.perl] Pb. with ioctl?

mf@uunet.UU.NET (mf) (01/27/91)

Setup:
	Perl 3.0.1.10 patch level 44
	Ultrix 4.0/4.1 on DEC/Mips

Problem:
	ioctl(STDIN, $TIOCGETP, $ttyb) || die "can't ioctl: $!";

	fails with "can't ioctl: Not a typewriter" even for 1-line
	programs (2-line, actually, with the require "sys/ioctl.ph").

Any ideas?

tchrist@convex.COM (Tom Christiansen) (01/27/91)

From the keyboard of mf@uunet.UU.NET (mf):
:	ioctl(STDIN, $TIOCGETP, $ttyb) || die "can't ioctl: $!";
:
:	fails with "can't ioctl: Not a typewriter" even for 1-line
:	programs (2-line, actually, with the require "sys/ioctl.ph").

Try:
    ioctl(STDIN, &TIOCGETP, $ttyb) || die "can't ioctl: $!";

h2ph doesn't create definitions of form $foo, but rather of form &foo
instead.  You might perhaps try to use h2pl for speed (which will produce
$foo things) if you get h2ph to work, but last time I ported it to a
different system, (SunOS 4.1) it took quite a lot of hacking to make it
work.

--tom

ps: also, do NOT h2pl syslog.ph or you'll blow away syslog.pl! sorry.
--
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el?  Now
 he can finally have the whole O/S built-in to his editor like he
 always wanted!" --me (Tom Christiansen <tchrist@convex.com>)