}
}
-void ntstdio_init(ntstdio_t *handle, NTSTDIO_XO xo, NTSTDIO_XI xi)
+void ntstdio_init(ntstdio_t *handle, unsigned int option, NTSTDIO_XI xi, NTSTDIO_XO xo)
{
- handle->xo = xo;
handle->xi = xi;
+ handle->xo = xo;
handle->outptr = 0;
+ handle->option = option;
}
void ntstdio_putc(ntstdio_t *handle, char c)
{
- if ((NTSTDIO_CR_CRLF) && (c == '\n')) {
+ if ((handle->option & NTSTDIO_OPTION_CR_CRLF) && (c == '\n')) {
ntstdio_putc(handle, '\r');
}
if ((c == '\b') && i) {
/* Back space */
i--;
- if (NTSTDIO_LINE_ECHO) {
+ if (handle->option & NTSTDIO_OPTION_LINE_ECHO) {
ntstdio_putc(handle, c);
}
continue;
if ((c >= ' ') && (i < len - 1)) {
/* Visible chars */
buf[i++] = c;
- if (NTSTDIO_LINE_ECHO) {
+ if (handle->option & NTSTDIO_OPTION_LINE_ECHO) {
ntstdio_putc(handle, c);
}
}
}
buf[i] = 0;
/* Terminate with a \0 */
- if (NTSTDIO_LINE_ECHO) {
+ if (handle->option & NTSTDIO_OPTION_LINE_ECHO) {
ntstdio_putc(handle, '\n');
}
return 1;