X-Git-Url: http://winboard.nl/cgi-bin?p=polyglot.git;a=blobdiff_plain;f=gui.cpp;h=354d276db72efe8693a98086948cae4020aa0ed1;hp=b80f576b7e6d20e1945820b92d6f3103762df4db;hb=6442b61046f46f65bfc4bf0b3727abe2dc27acb8;hpb=64f72f31685ea1dff12b19b22cfaf7a53ccc079f diff --git a/gui.cpp b/gui.cpp index b80f576..354d276 100644 --- a/gui.cpp +++ b/gui.cpp @@ -3,6 +3,7 @@ // includes #include +#include #include "gui.h" #include "main.h" @@ -17,19 +18,35 @@ gui_t GUI[1]; // functions +// sig_quit() + +static void sig_quit(int dummy){ + my_log("POLYGLOT *** SIGINT Received ***\n"); + quit(); +} + // gui_init() void gui_init(gui_t *gui){ - #ifdef _WIN32 + +// the following is nice if the "GUI" is a console! + signal(SIGINT,sig_quit); +#ifdef _WIN32 + signal(SIGTERM,SIG_IGN); +#ifdef SIGPIPE + signal(SIGPIPE,SIG_IGN); +#endif +#endif + +#ifdef _WIN32 (gui->pipeStdin).Open(); #else - // xboard - + gui->io->in_fd = STDIN_FILENO; gui->io->out_fd = STDOUT_FILENO; gui->io->name = "GUI"; - + io_init(gui->io); #endif } @@ -41,7 +58,7 @@ void gui_init(gui_t *gui){ bool gui_get_non_blocking(gui_t * gui, char string[], int size) { - ASSERT(xboard!=NULL); + ASSERT(gui!=NULL); ASSERT(string!=NULL); ASSERT(size>=256); #ifndef _WIN32 @@ -84,7 +101,7 @@ void gui_send(gui_t * gui, const char format[], ...) { va_list arg_list; char string[StringSize]; - ASSERT(xboard!=NULL); + ASSERT(gui!=NULL); ASSERT(format!=NULL); // format