Fix multi-leg promotions
[xboard.git] / zippy.c
diff --git a/zippy.c b/zippy.c
index 9fdedc5..247240d 100644 (file)
--- a/zippy.c
+++ b/zippy.c
@@ -5,7 +5,7 @@
  * Massachusetts.
  *
  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.
  *
  * Enhancements Copyright 2005 Alessandro Scotti
  *
@@ -105,7 +105,8 @@ static time_t zippyLastGameEnd;
 extern void mysrandom(unsigned int seed);
 extern int myrandom(void);
 
-void ZippyInit()
+void
+ZippyInit ()
 {
     char *p;
 
@@ -199,7 +200,7 @@ void ZippyInit()
     if (p != NULL) {
       appData.zippyVariants = p;
     }
-    safeStrCpy(first.variants, appData.zippyVariants, sizeof(first.variants)/sizeof(first.variants[0]));
+    ASSIGN(first.variants, appData.zippyVariants);
 
     srandom(time(NULL));
 }
@@ -304,8 +305,8 @@ char *swifties[] = {
 
 #define MAX_SPEECH 250
 
-void Speak(how, whom)
-     char *how, *whom;
+void
+Speak (char *how, char *whom)
 {
     static FILE *zipfile = NULL;
     static struct stat zipstat;
@@ -314,7 +315,6 @@ void Speak(how, whom)
     time_t now;
     char  *p;
     int c, speechlen;
-    Boolean done;
 
     if (strcmp(how, "shout") == 0) {
        now = time((time_t *) NULL);
@@ -345,7 +345,6 @@ void Speak(how, whom)
        if (c == EOF) continue;
        break;
     }
-    done = FALSE;
 
     /* Don't use ics_prefix; we need to let FICS expand the alias i -> it,
        but use the real command "i" on ICC */
@@ -381,8 +380,8 @@ void Speak(how, whom)
     Speak(how, whom);  /* tail recursion */
 }
 
-int ZippyCalled(str)
-     char *str;
+int
+ZippyCalled (char *str)
 {
     return ics_handle[0] != NULLCHAR && StrCaseStr(str, ics_handle) != NULL;
 }
@@ -392,12 +391,14 @@ static int num_opps=0;
 
 extern ColorClass curColor;
 
-static void SetCurColor( ColorClass color )
+static void
+SetCurColor (ColorClass color)
 {
     curColor = color;
 }
 
-static void ColorizeEx( ColorClass color, int cont )
+static void
+ColorizeEx (ColorClass color, int cont)
 {
     if( appData.colorize ) {
         Colorize( color, cont );
@@ -405,9 +406,8 @@ static void ColorizeEx( ColorClass color, int cont )
     }
 }
 
-int ZippyControl(buf, i)
-     char *buf;
-     int *i;
+int
+ZippyControl (char *buf, int *i)
 {
     char *player, *p;
     char reply[MSG_SIZ];
@@ -580,9 +580,8 @@ int ZippyControl(buf, i)
     return FALSE;
 }
 
-int ZippyConverse(buf, i)
-     char *buf;
-     int *i;
+int
+ZippyConverse(char *buf, int *i)
 {
     static char lastgreet[MSG_SIZ];
     char reply[MSG_SIZ];
@@ -658,7 +657,6 @@ int ZippyConverse(buf, i)
     /* Channel tells */
     oldi = *i;
     if (looking_at(buf, i, "*(*: *")) {
-       char *player;
        char *channel;
        if (star_match[0][0] == NULLCHAR  ||
            strchr(star_match[0], ' ') ||
@@ -668,7 +666,6 @@ int ZippyConverse(buf, i)
            return FALSE;
        }
        if (appData.zippyTalk) {
-         player = StripHighlightAndTitle(star_match[0]);
          channel = strrchr(star_match[1], '(');
          if (channel == NULL) {
            channel = star_match[1];
@@ -732,8 +729,8 @@ int ZippyConverse(buf, i)
     return FALSE;
 }
 
-void ZippyGameStart(white, black)
-     char *white, *black;
+void
+ZippyGameStart (char *white, char* black)
 {
     if (!first.initDone) {
       /* Game is starting prematurely.  We can't deal with this */
@@ -750,9 +747,8 @@ void ZippyGameStart(white, black)
     }
 }
 
-void ZippyGameEnd(result, resultDetails)
-     ChessMove result;
-     char *resultDetails;
+void
+ZippyGameEnd (ChessMove result, char *resultDetails)
 {
     if (appData.zippyAcceptOnly[0] == NULLCHAR &&
        appData.zippyGameEnd[0] != NULLCHAR) {
@@ -770,20 +766,16 @@ void ZippyGameEnd(result, resultDetails)
  * Routines to implement Zippy playing chess
  */
 
-void ZippyHandleChallenge(srated, swild, sbase, sincrement, opponent)
-     char *srated, *swild, *sbase, *sincrement, *opponent;
+void
+ZippyHandleChallenge (char *srated, char *swild, char *sbase, char *sincrement, char *opponent)
 {
     char buf[MSG_SIZ];
-    int base, increment, i=0;
-    char rated;
+    int i=0;
     VariantClass variant;
     char *varname;
 
-    rated = srated[0];
     variant = StringToVariant(swild);
     varname = VariantName(variant);
-    base = atoi(sbase);
-    increment = atoi(sincrement);
 
     /* [DM] If icsAnalyzeEngine active we don't accept automatic games */
     if (appData.icsActive && appData.icsEngineAnalyze) return;
@@ -859,9 +851,8 @@ void ZippyHandleChallenge(srated, swild, sbase, sincrement, opponent)
 
 
 /* Accept matches */
-int ZippyMatch(buf, i)
-     char *buf;
-     int *i;
+int
+ZippyMatch (char *buf, int *i)
 {
     if (looking_at(buf, i, "* * match * * requested with * (*)")) {
 
@@ -979,8 +970,8 @@ int ZippyMatch(buf, i)
 /* Initialize chess program with data from the first board
  * of a new or resumed game.
  */
-void ZippyFirstBoard(moveNum, basetime, increment)
-     int moveNum, basetime, increment;
+void
+ZippyFirstBoard (int moveNum, int basetime, int increment)
 {
     char buf[MSG_SIZ];
     int w, b;
@@ -1143,8 +1134,7 @@ void ZippyFirstBoard(moveNum, basetime, increment)
 
 
 void
-ZippyHoldings(white_holding, black_holding, new_piece)
-     char *white_holding, *black_holding, *new_piece;
+ZippyHoldings (char *white_holding, char *black_holding, char *new_piece)
 {
     char buf[MSG_SIZ];
     if (gameMode != IcsPlayingBlack && gameMode != IcsPlayingWhite) return;