OSDN Git Service

\e$B%A%1%C%H\e(B #30714 xprintf\e$B%b%8%e!<%k$N:o=|$H\e(Bntstdio\e$B%b%8%e!<%k$NDI2C\e(B
[uzume/uzume_bfin.git] / uzumeapp / kernel / uzume / ntshell / ntstdio.c
index 1b84c41..5b1ce3a 100644 (file)
@@ -215,16 +215,17 @@ static void xvprintf(ntstdio_t *handle, const char *fmt, va_list arp)
     }
 }
 
-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');
     }
 
@@ -328,7 +329,7 @@ int ntstdio_gets(ntstdio_t *handle, char *buf, int len)
         if ((c == '\b') && i) {
             /* Back space */
             i--;
-            if (NTSTDIO_LINE_ECHO) {
+            if (handle->option & NTSTDIO_OPTION_LINE_ECHO) {
                 ntstdio_putc(handle, c);
             }
             continue;
@@ -336,14 +337,14 @@ int ntstdio_gets(ntstdio_t *handle, char *buf, int len)
         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;