remove linux stdout redirect stuff

master
insofaras 2016-03-21 18:42:14 +00:00
parent 8ca38b5f73
commit 7b10afa457
1 changed files with 0 additions and 44 deletions

View File

@ -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;