X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=031141af6ae952273a5a71f939c04f8a516c0c89;hb=d91dfdc72d9abeb6733b72c9bef81ccee55b9735;hp=7672207afe4c942a156151048f99e6c5065c79ac;hpb=66f14eb096ba84841fac34a4cd10686aa9033b6b;p=xboard.git diff --git a/backend.c b/backend.c index 7672207..031141a 100644 --- a/backend.c +++ b/backend.c @@ -1351,6 +1351,19 @@ establish() } } +void EscapeExpand(char *p, char *q) +{ // [HGM] initstring: routine to shape up string arguments + while(*p++ = *q++) if(p[-1] == '\\') + switch(*q++) { + case 'n': p[-1] = '\n'; break; + case 'r': p[-1] = '\r'; break; + case 't': p[-1] = '\t'; break; + case '\\': p[-1] = '\\'; break; + case 0: *p = 0; return; + default: p[-1] = q[-1]; break; + } +} + void show_bytes(fp, buf, count) FILE *fp; @@ -7334,11 +7347,13 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats. * Look for communication commands */ if (!strncmp(message, "telluser ", 9)) { + EscapeExpand(message+9, message+9); // [HGM] esc: allow escape sequences in popup box DisplayNote(message + 9); return; } if (!strncmp(message, "tellusererror ", 14)) { cps->userError = 1; + EscapeExpand(message+14, message+14); // [HGM] esc: allow escape sequences in popup box DisplayError(message + 14, 0); return; }