[comp.unix.xenix] FIORDCHK

jeff@questar.QUESTAR.MN.ORG (Jeff Holmes) (01/13/90)

	I was wondering if someone at SCO could field this (or
	anyone else for that matter).

	I'm trying to find a portable way to check for function
	key presses. I know about rdchk(), and I've had a lot
	of good suggestions from the net, but I'm trying to find
	the BEST way I can to do this.

	Which brings me to my question...

	I have Xenix 386 2.3.2 and while browsing through 
	/usr/include/term.h and /usr/include/sys/ioctl.h
	I found reference to FIONREAD and FIORDCHK.

	On a BSD system I would do...

		int n;
		ioctl(0, FIONREAD, &n);

	where n would contain the number of chars to get.

	In /usr/include/term.h there is a comment about modification
	history dated MAR 18,1988 and the comment...

	   ...added XENIX FIORDCHK as alternative to BSD FIONREAD...

	So i tried x = ioctl(0, FIORDCHK, &n) and noticed that "n"
	did NOT change but the return value from ioctl was 1 on
	a function key press and 0 for anything that returned a single
	character.

	Since the use of FIORDCHK is undocumented could someone
	enlighten me as to the proper use of FIORDCHK?

	Much thanks,
		Jeff
-- 
Jeff Holmes	                  DOMAIN: jeff@questar.mn.org 
Questar Data Systems                UUCP: amdahl!bungia!questar!jeff
St. Paul, MN 55121		    AT&T: +1 612 688 0089

erc@khijol.UUCP (Edwin R. Carp) (01/15/90)

In article <4587@questar.QUESTAR.MN.ORG> jeff@questar.UUCP (Jeff Holmes) writes:
>
>	I'm trying to find a portable way to check for function
>	key presses.

Have you tried keypad() in conjunction with getch()?  If you are using curses,
this is the best portable way to do what you want to do.
-- 
Ed Carp			N7EKG/5 (28.3-28.5)	uunet!cs.utexas.edu!khijol!erc
Austin, Texas		(512) 832-5884		"Good tea.  Nice house." - Worf

aryeh@eddie.mit.edu (Aryeh M. Weiss) (01/16/90)

In article <4587@questar.QUESTAR.MN.ORG> jeff@questar.UUCP (Jeff Holmes) writes:
>...
>	In /usr/include/term.h there is a comment about modification
>	history dated MAR 18,1988 and the comment...
>
>	   ...added XENIX FIORDCHK as alternative to BSD FIONREAD...
>
>	So i tried x = ioctl(0, FIORDCHK, &n) and noticed that "n"
>	did NOT change but the return value from ioctl was 1 on
>	a function key press and 0 for anything that returned a single
>	character.
>
See the SCO function rdchk(S).  Rdchk(S) returns 1 if there is data to
be read from the tty.  FIORDCHK sounds like it is the ioctl interface to
the same function or else rdchk is a wrapper function for this ioctl call.
-- 

daveh@marob.masa.com (Dave Hammond) (01/18/90)

In article <1027@khijol.UUCP> erc@khijol.UUCP writes:
>In article <4587@questar.QUESTAR.MN.ORG> jeff@questar.UUCP writes:
>>	I'm trying to find a portable way to check for function
>>	key presses.
>Have you tried keypad() in conjunction with getch()?  If you are using curses,
>this is the best portable way to do what you want to do.

Keypad() is likely to be portable only amongst Xenix and SysV systems.
Most BSD-derived systems do not support keypad(), idlok(), etc.  Also,
some versions of Xenix include broken keypad() implementations (I recall
that certain standard ASCII keys returned null when pressed).

--
Dave Hammond
daveh@marob.masa.com
uunet!masa.com!marob!daveh