This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tty_write yields written bytes count



Hi,

I'm using the TTY driver with CR/LF translations for console IO. When I
write a single '\n', I get the assertion failure below:

ASSERT FAIL: <4>stream.inl [ 179]
Cyg_ErrNo Cyg_StdioStream::write_byte()
Single byte not written, but no error returned!

The tty_write() routine translates the '\n' into '\r\n' and thus returns
2 which confuses the Cyg_StdioStream::write_byte() routine.

I believe that tty_write() should return the number of bytes consumed
and successfully passed to the underlying device. The attached patch
proposes a possible modification to tty_write() and a ChangeLog entry
follows just in case ...

Robin

2002-02-25  Robin Farine  <robin.farine@terminus.org>

	* src/common/tty.c (tty_write): Instead of the number of bytes
	actually written (which may include extra bytes due to e.g. CR/LF
	translations), yields the number of bytes consumed from the
	caller's buffer and successfully passed to the underlying output
	channel.

Attachment: tty.diff
Description: Text document

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

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