]> thyrsus.com Git - bs.git/commitdiff
Use bools and stdlib.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 19 Oct 2010 10:19:17 +0000 (06:19 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 19 Oct 2010 10:19:17 +0000 (06:19 -0400)
bs.c

diff --git a/bs.c b/bs.c
index 0fb5e8a1af5cff83ebb1e1175ebd54dece25f671..07bc2d5b2537be7fee5c1f96a95fff3d6b265594 100644 (file)
--- a/bs.c
+++ b/bs.c
@@ -3,8 +3,6 @@
  *             salvo option by: Chuck A DeGaul
  * with improved user interface, autoconfiguration and code cleanup
  *             by Eric S. Raymond <esr@snark.thyrsus.com>
- *
- * $Id: bs.c,v 1.9 2001/05/07 20:27:59 esr Exp esr $
  */
 
 #include <curses.h>
@@ -14,6 +12,8 @@
 #include <assert.h>
 #include <time.h>
 #include <unistd.h>
+#include <stdlib.h>
+#include <stdbool.h>
 
 #ifndef SIGIOT
 #define SIGIOT SIGABRT
@@ -154,7 +154,7 @@ static char board[2][BWIDTH][BDEPTH];
 static int turn;                       /* 0=player, 1=computer */
 static int plywon=0, cpuwon=0;         /* How many games has each won? */
 
-static int salvo, blitz, closepack;
+static bool salvo, blitz, closepack;
 
 #define        PR      (void)addstr
 
@@ -1175,8 +1175,8 @@ static void do_options(int c, char *op[])
                switch(op[i][1])
                {
                case 'b':
-                   blitz = 1;
-                   if (salvo == 1)
+                   blitz = true;
+                   if (salvo)
                    {
                        (void) fprintf(stderr,
                                "Bad Arg: -b and -s are mutually exclusive\n");
@@ -1184,8 +1184,8 @@ static void do_options(int c, char *op[])
                    }
                    break;
                case 's':
-                   salvo = 1;
-                   if (blitz == 1)
+                   salvo = true;
+                   if (blitz)
                    {
                        (void) fprintf(stderr,
                                "Bad Arg: -s and -b are mutually exclusive\n");
@@ -1193,7 +1193,7 @@ static void do_options(int c, char *op[])
                    }
                    break;
                case 'c':
-                   closepack = 1;
+                   closepack = true;
                    break;
                default:
                    (void) fprintf(stderr,