Changeset: 9d63efa61173 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d63efa61173
Modified Files:
        monetdb5/mal/mal_readline.c
Branch: port-monetdblite
Log Message:

Use mnstr_* instead of stdio functions.


diffs (40 lines):

diff --git a/monetdb5/mal/mal_readline.c b/monetdb5/mal/mal_readline.c
--- a/monetdb5/mal/mal_readline.c
+++ b/monetdb5/mal/mal_readline.c
@@ -24,8 +24,8 @@
 static void
 showCommands(void)
 {
-       printf("?\t - show this message\n");
-       printf("\\q\t- terminate session\n");
+       mnstr_printf(GDKout, "?\t - show this message\n");
+       mnstr_printf(GDKout, "\\q\t- terminate session\n");
 }
 
 char *
@@ -40,8 +40,8 @@ getConsoleInput(Client c, const char *pr
 
        do {
                if (prompt) {
-                       fputs(prompt, stdout);
-                       fflush(stdout);
+                       mnstr_writeStr(GDKout, prompt);
+                       mnstr_flush(GDKout);
                }
                if (buf == NULL) {
                        buf= malloc(BUFSIZ);
@@ -50,9 +50,11 @@ getConsoleInput(Client c, const char *pr
                                return NULL;
                        }
                }
-               line = fgets(buf, BUFSIZ, stdin);
-
-               if (line == NULL) {
+               if (mnstr_read(GDKin, buf, 1, BUFSIZ) > 0)
+                       line = buf;
+               else
+                       line = NULL;
+               if (line == NULL || *line == '\0') {
                        /* end of file */
                        if (buf)
                                free(buf);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to