From: H.G. Muller Date: Wed, 8 Feb 2012 16:47:46 +0000 (+0100) Subject: Fix TidyProgramName X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=53c1e5069c952812b429d7c141cf201edf6afaae;p=xboard.git Fix TidyProgramName A trailing .exe was not removed if the engine name was quoted. --- diff --git a/backend.c b/backend.c index 0a736e7..92a228d 100644 --- a/backend.c +++ b/backend.c @@ -14648,7 +14648,7 @@ PrintOpponents (FILE *fp) void TidyProgramName (char *prog, char *host, char buf[MSG_SIZ]) { - char *p, *q; + char *p, *q, c; int local = (strcmp(host, "localhost") == 0); while (!local && (p = strchr(prog, ';')) != NULL) { p++; @@ -14665,7 +14665,8 @@ TidyProgramName (char *prog, char *host, char buf[MSG_SIZ]) while (p >= prog && *p != '/' && *p != '\\') p--; p++; if(p == prog && *p == '"') p++; - if (q - p >= 4 && StrCaseCmp(q - 4, ".exe") == 0) q -= 4; + c = *q; *q = 0; + if (q - p >= 4 && StrCaseCmp(q - 4, ".exe") == 0) *q = c, q -= 4; else *q = c; memcpy(buf, p, q - p); buf[q - p] = NULLCHAR; if (!local) {