printf, data presentation

Roland Dunkerley orion at nuchat
Mon Jan 9 18:38:58 AEST 1989


In article <8800006 at gistdev>, flint at gistdev writes:
>
>I've found ioctl to be about the least portable thing in UNIX.  (FIONREAD
>isn't in the SVID, or at least I couldn't find it in TERMIO(BA_ENV) or
>IOCTL(BA_OS), so if it is in SVID & I missed it, I'd appreciate being
>enlightened.) 
This is true, System V R3 provides (non-portable) functional
equivalants to FIONREAD and the select() call but, it only works on
streams devices...  Maybe R4 will get it right?
>
>  .....  (For example, if I want my user
>to type as many keys as they want to within 10 seconds, and then evaluate
>that amount of input, I'm stuck: I have to change the timelimit with each
>successive keypress to be "10 - time_used_so_far", and the only way to do
>so is with an incredibly slow ioctl() call on each keypress.  Some Guru
>out there might know some neat way to do this I haven't heard about:
>if you know how to do it in Sys V without having to go way out of your
>way with something like writing your own device driver, I'd like to hear
>your solution.)
how about the following:

catch()
{
	signal ( SIGINT, catch );
	signal ( SIGQUIT, catch );
	signal ( SIGALRM, catch );
	alarm(0);
}
/* ...... */
        catch();

	alarm(10);
	if( count=read(0, &buffer, buffer_size)==-1 )
	{
	    alarm(0);
	    /* Handle failure */
	}
        
I think this is portable and should achieve the desired result.  We
use this in the autobaud section of our local getty.
>
>Flint Pellett, Global Information Systems Technology, Inc.
>1800 Woodfield Drive, Savoy, IL  61874     (217) 352-1165
>INTERNET: flint%gistdev at uxc.cso.uiuc.edu
>UUCP:     {uunet,pur-ee,convex}!uiucuxc!gistdev!flint
Roland Dunkerley III
*** (orion at nuchat.UUCP)  (uunet.UU.NET!nuchat!orion)
*** South Coast Computing Services
*** We service Publicly Redistributable software - reasonable rates
*** Inquire within



More information about the Comp.unix.wizards mailing list