X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=usystem.c;h=a469fe780db47f920022e82f1fcecd17e6e95b19;hb=0278ebc80411a20fd23303156285e55ce8d2b0a5;hp=6ac238c493ad290426748c4bb96adb7fd5cdf018;hpb=1a74e7cd3bed2116e9bcfc4d2b5f270895dff16c;p=xboard.git diff --git a/usystem.c b/usystem.c index 6ac238c..a469fe7 100644 --- a/usystem.c +++ b/usystem.c @@ -5,7 +5,8 @@ * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free + * Software Foundation, Inc. * * The following terms apply to Digital Equipment Corporation's copyright * interest in XBoard: @@ -263,6 +264,7 @@ ParseIcsTextColors () } textColors[ColorNone].fg = textColors[ColorNone].bg = -1; textColors[ColorNone].attr = 0; + SetTextColor(cnames, textColors[ColorNormal].fg - 30, textColors[ColorNormal].bg - 40, -2); // kludge to announce background color to front-end } static Boolean noEcho; @@ -307,6 +309,8 @@ Colorize (ColorClass cc, int continuation) char buf[MSG_SIZ]; int count, outCount, error; + SetTextColor(cnames, textColors[(int)cc].fg - 30, textColors[(int)cc].bg - 40, textColors[(int)cc].attr); // for GTK widget + if (textColors[(int)cc].bg > 0) { if (textColors[(int)cc].fg > 0) { snprintf(buf, MSG_SIZ, "\033[0;%d;%d;%dm", textColors[(int)cc].attr, @@ -647,18 +651,20 @@ OpenRcmd (char *host, char *user, char *cmd, ProcRef *pr) return -1; } +Boolean stdoutClosed = FALSE; + int OutputToProcess (ProcRef pr, char *message, int count, int *outError) { static int line = 0; ChildProc *cp = (ChildProc *) pr; - int outCount; + int outCount = count; if (pr == NoProc) { - if (appData.noJoin || !appData.useInternalWrap) - outCount = fwrite(message, 1, count, stdout); - else + if (appData.noJoin || !appData.useInternalWrap) { + if(!stdoutClosed) outCount = fwrite(message, 1, count, stdout); + } else { int width = get_term_width(); int len = wrap(NULL, message, count, width, &line); @@ -676,6 +682,7 @@ OutputToProcess (ProcRef pr, char *message, int count, int *outError) free(msg); } } + if(*message != '\033') ConsoleWrite(message, count); } else outCount = write(cp->fdTo, message, count);