This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to handle terminal I/O


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]