From 7b10afa45756ff8b0d0f893f08b3753095f70437 Mon Sep 17 00:00:00 2001 From: insofaras Date: Mon, 21 Mar 2016 18:42:14 +0000 Subject: [PATCH] remove linux stdout redirect stuff --- linux_4ed.cpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/linux_4ed.cpp b/linux_4ed.cpp index 17360be1..7caca93b 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -155,9 +155,6 @@ struct Linux_Vars{ Linux_Coroutine coroutine_data[2]; Linux_Coroutine *coroutine_free; - - int stdout_orig; - int stdout_redir[2]; }; #define LINUX_MAX_PASTE_CHARS 0x10000L @@ -1876,21 +1873,6 @@ main(int argc, char **argv) } if (output_size != 0) return 0; - // NOTE(allen): Now that we are done using the normal stdout stuff - // redirect it to a pipe so the application can render future printf itself. - - linuxvars.stdout_orig = dup(STDOUT_FILENO); - - if(pipe(linuxvars.stdout_redir) == -1){ - perror("pipe"); - } else { - if(dup2(linuxvars.stdout_redir[1], STDOUT_FILENO) == -1){ - perror("dup2"); - } else { - setlinebuf(stdout); - } - } - sysshared_filter_real_files(files, file_count); linuxvars.XDisplay = XOpenDisplay(0); @@ -2491,32 +2473,6 @@ main(int argc, char **argv) ); } - // NOTE(inso): copy stdout to app->print (TODO) - { - fd_set fds; - FD_ZERO(&fds); - FD_SET(linuxvars.stdout_redir[0], &fds); - struct timeval tv = {}; - char buf[1024]; - - while(select(linuxvars.stdout_redir[0] + 1, &fds, NULL, NULL, &tv) == 1){ - ssize_t sz = read(linuxvars.stdout_redir[0], buf, sizeof(buf)); - if(sz == 0){ - break; - } else if(sz < 0){ - perror("stdout_redir read"); - } else { - write(linuxvars.stdout_orig, buf, sz); - - // TODO(inso): send the message to app->print_message somehow? - //String str = make_string(buf, sz, sz); - //linuxvars.app.print_message(app, str, sz); - } - - tv = {}; - } - } - Key_Input_Data input_data; Mouse_State mouse; Application_Step_Result result;