How to handle terminal I/O
Mats Liljegren
mats.liljegren@enea.se
Fri Sep 1 05:38:00 GMT 2000
Hi all,
I'm trying to get my system functions correctly, especially read and
fstat. I'd like reading to be done character by character, but output
should be line based.
How do I get this behaviour?
Right now, fstat does the following:
int fstat( int file, struct stat st )
{
switch( file )
{
case 0:
case 1:
case 2:
st->st_blksize = 0;
st->st_mode = S_IFCHR;
break;
default:
errno = EINVAL;
return -1;
}
return 0;
}
and isatty looks like follows:
int isatty( int file )
{
return 1;
}
But any call to getchar() ends up reading 1023 bytes with a call to
read. Not much of command line editing is possible with such a
behaviour...
Best regards,
Mats
More information about the Newlib
mailing list