return variantNames[v];
}
+char *
+SpaceStrCaseStr(char *e, char *name)
+{
+ char *p = StrCaseStr(e, name);
+ if(!p) return NULL;
+ if(p == e || p[-1] == ' ') return p;
+ return NULL;
+}
/* Identify a variant from the strings the chess servers use or the
PGN Variant tag names we use. */
}
if (!found) {
- if ((StrCaseStr(e, "fischer") && StrCaseStr(e, "random"))
- || StrCaseStr(e, "wild/fr")
- || StrCaseStr(e, "frc") || StrCaseStr(e, "960")) {
+ if ((SpaceStrCaseStr(e, "fischer") && StrCaseStr(e, "random"))
+ || SpaceStrCaseStr(e, "wild/fr")
+ || SpaceStrCaseStr(e, "frc") || SpaceStrCaseStr(e, "960") || SpaceStrCaseStr(e, "chess960")) {
v = VariantFischeRandom;
- } else if ((i = 4, p = StrCaseStr(e, "wild")) ||
- (i = 1, p = StrCaseStr(e, "w"))) {
+ } else if ((i = 4, p = SpaceStrCaseStr(e, "wild")) ||
+ (i = 1, p = SpaceStrCaseStr(e, "w"))) {
p += i;
while (*p && (isspace(*p) || *p == '(' || *p == '/')) p++;
if (isdigit(*p)) {