[syslog] Separate out generic line-based console functionality

Abstract out the generic line-handling portions of the syslog
putchar() routine, to allow use by other console types.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2012-02-28 22:45:32 +00:00
parent c72b8969e2
commit 851b93fbc3
3 changed files with 117 additions and 36 deletions

View File

@@ -0,0 +1,33 @@
#ifndef _IPXE_LINECONSOLE_H
#define _IPXE_LINECONSOLE_H
/** @file
*
* Line-based console
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
/** A line-based console */
struct line_console {
/** Data buffer
*
* Must initially be filled with NULs
*/
char *buffer;
/** Current index within buffer */
size_t index;
/** Length of buffer
*
* The final character of the buffer will only ever be used as
* a potential terminating NUL.
*/
size_t len;
};
extern size_t line_putchar ( struct line_console *line, int character );
#endif /* _IPXE_LINECONSOLE_H */