[klibc] Releasing a klibc-1.5

David Härdeman david at hardeman.nu
Tue Feb 20 01:36:57 PST 2007


On Mon, February 19, 2007 17:56, H. Peter Anvin said:
> sferriol wrote:
>> do not use timeout_read, it just detects a key pressed during a lapse of
>> time. I think the best is to add -t option in dash read function, see
>> patch attached
>>
>>  	if ((ifs = bltinlookup("IFS")) == NULL)
>>  		ifs = defifs;
>> +	if (ts.tv_sec || ts.tv_usec) {
>> +		FD_ZERO (&set);
>> +		FD_SET (0, &set);
>> +
>> +		i = select (FD_SETSIZE, &set, NULL, NULL, &ts);
>> +		if (!i) {
>> +			return 1;
>> +		}
>> +	}
>>  	status = 0;
>
> What is it you really want done here?  That the read fails unless it is
> *complete* before the timeout?  If so, the above is wrong; it will reset
> the timeout on every character (or worse, the first character only...
> I'm not 100% sure since haven't looked at the code in detail.)

IIRC, timeout_read.c is used in rootskel to create a "Please remove the
boot floppy and insert the root floppy, then press enter..." kind of
dialogue which continues automatically after a timeout (e.g. if a USB
keyboard is used and the BIOS does not support USB keyboards).

If the "-t" option is added to dash it seems reasonable to make sure it
mimics the behaviour of bash (i.e. timeout if a complete line has not been
read within the specified number of seconds).

-- 
David Härdeman



More information about the klibc mailing list