Various fixes for booklook.
authorSteinar H. Gunderson <sesse@debian.org>
Wed, 18 Jul 2007 16:18:35 +0000 (18:18 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Wed, 18 Jul 2007 16:18:35 +0000 (18:18 +0200)
booklook.c

index c4705b7..c9eea59 100644 (file)
@@ -330,8 +330,11 @@ void encode_position(char *board, int invert, char *castling_rights, char *ep_co
 
        // padding stuff
 #if 1
-       if (bits_left != 8)
-               ++pos_len;
+       if (bits_left != 8) {
+               int i, nd = 8 - bits_left;
+               for (i = 0; i < nd; ++i)
+                       put_bit(0);
+       }
 #endif
                
        // and the header byte
@@ -342,7 +345,7 @@ void encode_position(char *board, int invert, char *castling_rights, char *ep_co
        if (ep_any)
                position[0] |= 0x20;
 
-#if 1
+#if 0
        // dump
        {
                int i;
@@ -806,5 +809,6 @@ int main(int argc, char **argv)
        }
 
        dump_info(board, argv[3], argv[4], invert, result);
+       exit(0);
 }