This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
How to handle terminal I/O
- Subject: How to handle terminal I/O
- From: Mats Liljegren <mats dot liljegren at enea dot se>
- Date: Fri, 01 Sep 2000 14:59:02 +0200
- CC: newlib <newlib at sources dot redhat dot com>
- Organization: Enea Realtime AB
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