Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!cse!texas!harrison From: harrison@csl.dl.nec.com (Mark Harrison) Newsgroups: comp.lang.perl Subject: can't get ioctl value Message-ID: <1991May15.003413.22693@csl.dl.nec.com> Date: 15 May 91 00:34:13 GMT Organization: NEC America, C & C Software Development Laboratory Lines: 42 I am having a problem getting the value needed for an TIOCGWINSZ (get window size) ioctl. If I hardcode the value printed by the C program, everything works correctly. I have run "h2ph * */*" in /usr/include. Anybody have a clue? Thanks in advance! C program: > #include > #include > main(){printf("%d\n", TIOCGWINSZ);} from ioccom.ph: > eval 'sub _IOR { > local($x,$y,$t) = @_; > eval "( &_IOC_OUT|(($sizeof{$t}& &_IOCPARM_MASK)<<16)|(ord(\'$x\')<<8)|$y)"; > }'; from ttycom.ph: > eval 'sub TIOCGWINSZ { &_IOR("t", 104, struct winsize);}'; My program: #!/usr/local/bin/perl require "sys/ioccom.ph"; require "sys/ttycom.ph"; $x = &TIOCGWINSZ; print "x =", $x, ":\n"; print "TIOCGWINSZ =", &TIOCGWINSZ, ":\n"; ioctl(STDIN, &TIOCGWINSZ, $gettyval) || die "can't get window size"; #ioctl(STDIN, 1074295912, $gettyval); # <-- this one works ok. ($Rows, $Cols) = unpack("ss", $gettyval); ~ My output: > x =: > TIOCGWINSZ =: > can't get window size at foo line 13. -- Mark Harrison | Note: harrison@ssd.dl.nec.com and harrison@csl.dl.nec.com | necssd!harrison are not operating at (214)518-5050 | present. Please forward mail through the | above address. Sorry for the inconvenience.