Allow ICS nickname as positional argument
[xboard.git] / args.h
diff --git a/args.h b/args.h
index 1a16ed2..6e3c3ac 100644 (file)
--- a/args.h
+++ b/args.h
@@ -104,6 +104,9 @@ IcsTextMenuEntry icsTextMenuEntry[ICS_TEXT_MENU_SIZE];
 int junk;
 Boolean singleList;
 char *homeDir;
+char *firstEngineLine;
+char *secondEngineLine;
+char *icsNick;
 
 void EnsureOnScreen(int *x, int *y, int minX, int minY);
 char StringGet(void *getClosure);
@@ -141,6 +144,7 @@ ArgDescriptor argDescriptors[] = {
   { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
   { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
   { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
+  { "is", ArgString, (void *) &icsNick, FALSE, INVALID },
   { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
   { "", ArgNone, NULL, FALSE, INVALID },
   /* keyword arguments */
@@ -172,6 +176,8 @@ ArgDescriptor argDescriptors[] = {
   { "secondChessProgram", ArgFilename, (void *) &appData.secondChessProgram,
     FALSE, (ArgIniType) SECOND_CHESS_PROGRAM },
   { "scp", ArgFilename, (void *) &appData.secondChessProgram, FALSE, INVALID },
+  { "fe", ArgString, (void *) &firstEngineLine, FALSE, "" },
+  { "se", ArgString, (void *) &secondEngineLine, FALSE, "" },
   { "firstPlaysBlack", ArgBoolean, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
   { "fb", ArgTrue, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
   { "xfb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
@@ -230,6 +236,7 @@ ArgDescriptor argDescriptors[] = {
   { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE },
   { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
   { "-ics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
+  { "is", ArgString, (void *) &icsNick, FALSE, "" },
   { "internetChessServerHost", ArgString, (void *) &appData.icsHost, FALSE, (ArgIniType) "" },
   { "icshost", ArgString, (void *) &appData.icsHost, FALSE, INVALID },
   { "internetChessServerPort", ArgString, (void *) &appData.icsPort, FALSE, (ArgIniType) ICS_PORT },
@@ -861,7 +868,7 @@ ParseArgs(GetFunc get, void *cl)
   char *q;
   int i, octval;
   char ch;
-  int posarg = 3; // default is game file
+  int posarg = 4; // default is game file
 
   ch = get(cl);
   for (;;) {
@@ -1037,6 +1044,8 @@ ParseArgs(GetFunc get, void *cl)
         appData.viewer = TRUE;
       } else if(!strcasecmp(argValue + len, ".ini") || !strcasecmp(argValue + len, ".xop")) {
         ad = &argDescriptors[0]; // correct implied type to -opt
+      } else if(GetEngineLine(argValue, 11)) {
+        ad = &argDescriptors[3]; // correct implied type to -is
       } else { // keep default -lgf, but let it imply viewer mode as well
         appData.viewer = TRUE;
       }
@@ -1280,6 +1289,8 @@ InitAppData(char *lpCmdLine)
 
   if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
   if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
+  chessProgram = GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);
+  appData.icsActive = GetEngineLine(icsNick, 10);
 
   /* [HGM] make sure board size is acceptable */
   if(appData.NrFiles > BOARD_FILES ||