X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=args.h;h=e94c16b442cbceca67a53cd44837a517e9e2b6f2;hb=8e2285c90cf5a1230fdf8fde9640c5a0ea67f0c4;hp=9a5b9e922b23f2ed45ba7941f45a6691ee2925f0;hpb=f5ce0900b7858572cfe4dbf65d633983a8b6f0b2;p=xboard.git diff --git a/args.h b/args.h index 9a5b9e9..e94c16b 100644 --- a/args.h +++ b/args.h @@ -208,6 +208,7 @@ ArgDescriptor argDescriptors[] = { { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY }, { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE }, + { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE }, { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL }, { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID }, { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID }, @@ -572,6 +573,7 @@ ArgDescriptor argDescriptors[] = { { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID }, { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID }, { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID }, + { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, FALSE }, #ifdef ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, @@ -697,6 +699,14 @@ ExitArgError(char *msg, char *badArg) exit(2); } +int +ValidateInt(char *s) +{ + char *p = s; + if(*p == '-' || *p == '+') p++; + while(*p) if(!isdigit(*p++)) ExitArgError("Bad integer value", s); + return atoi(s); +} char StringGet(void *getClosure) @@ -917,19 +927,19 @@ ParseArgs(GetFunc get, void *cl) switch (ad->argType) { case ArgInt: - *(int *) ad->argLoc = atoi(argValue); + *(int *) ad->argLoc = ValidateInt(argValue); break; case ArgX: - *(int *) ad->argLoc = atoi(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute + *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute break; case ArgY: - *(int *) ad->argLoc = atoi(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...) + *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...) break; case ArgZ: - *(int *) ad->argLoc = atoi(argValue); + *(int *) ad->argLoc = ValidateInt(argValue); EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY); break;