audk/StdLib/LibC/Uefi/InteractiveIO
Daryl McDaniel 86f2165dc3 StdLib: Fix IIO_Write() to return the number of bytes consumed, not characters output.
Depending upon termios settings, writing to a terminal device may result in
many more characters being output than were in the buffer provided to the
IIO_Write() function.

IIO_Write() is supposed to return the number of BYTES written, not characters.
Since the provided buffer contains MBCS characters, there can be up to three
bytes per character.  Due to the expansion that may occur, "BYTES written"
is interpreted to mean the number of BYTES consumed from the MBCS buffer
provided as a parameter to IIO_Write.

These changes ensure that the correct number of characters are consumed from
the internal Output buffer and the correct number of BYTES consumed from the
buffer parameter are counted and returned.

Update copyright.
Fix some indentation and white space issues.
Improve comments for IIO_Write().
Add debugging instrumentation to count unconsumed data in the Input and Output buffers.
Modify IIO_Write() to:
  Accurately count input bytes CONSUMED.
  Consume only as many expanded (cooked) characters from the output buffer
  as were actually sent to the device.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel <edk2-lists@mc2research.org>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19589 6f19259b-4bc3-4df7-8a09-765794883524
2016-01-06 00:44:24 +00:00
..
CanonRead.c
IIO.c StdLib: Fix IIO_Write() to return the number of bytes consumed, not characters output. 2016-01-06 00:44:24 +00:00
IIO.inf
IIOecho.c
IIOechoCtrl.h
IIOutilities.c StdLib: Fix GCC warnings/errors caused by variables being set but not used. 2014-10-30 01:05:22 +00:00
IIOutilities.h
IIOwrite.c StdLib: Fix GCC warnings/errors caused by variables being set but not used. 2014-10-30 01:05:22 +00:00
NonCanonRead.c StdLib: Fix GCC warnings/errors caused by variables being set but not used. 2014-10-30 01:05:22 +00:00
TerminalFunctions.c