Index: interface/play_gmp.c
===================================================================
--- interface/play_gmp.c	(revision 2399)
+++ interface/play_gmp.c	(working copy)
@@ -103,6 +103,9 @@
   }
 
   gameinfo->handicap = gmp_handicap(ge);
+  if (!check_boardsize(gmp_size(ge), stderr))
+    exit(EXIT_FAILURE);
+  
   gnugo_clear_board(gmp_size(ge));
 
   /* Let's pretend GMP knows about komi in case something will ever change. */
Index: interface/play_ascii.c
===================================================================
--- interface/play_ascii.c	(revision 2399)
+++ interface/play_ascii.c	(working copy)
@@ -715,10 +715,8 @@
 	    printf("\nInvalid command syntax!\n");
 	    break;
 	  }
-	  if (num < MIN_BOARD || num > MAX_BOARD) {
-	    printf("\nInvalid board size: %d\n", num);
+	  if (!check_boardsize(num, stdout))
 	    break;
-	  }
 	  /* Init board. */
 	  board_size = num;
 	  clear_board();
Index: interface/play_gtp.c
===================================================================
--- interface/play_gtp.c	(revision 2399)
+++ interface/play_gtp.c	(working copy)
@@ -442,7 +442,7 @@
   if (sscanf(s, "%d", &boardsize) < 1)
     return gtp_failure("boardsize not an integer");
   
-  if (boardsize < MIN_BOARD || boardsize > MAX_BOARD) {
+  if (!check_boardsize(boardsize, NULL)) {
     if (gtp_version == 1)
       return gtp_failure("unacceptable boardsize");
     else
Index: interface/main.c
===================================================================
--- interface/main.c	(revision 2399)
+++ interface/main.c	(working copy)
@@ -510,16 +510,10 @@
       case OPT_BOARDSIZE:
         {
 	  int boardsize = atoi(gg_optarg);
-	  
-	  if (boardsize < MIN_BOARD || boardsize > MAX_BOARD) {
-	    fprintf(stderr, "Unsupported board size: %d. ", boardsize);
-	    if (boardsize < MIN_BOARD)
-	      fprintf(stderr, "Min size is %d.\n", MIN_BOARD);
-	    else
-	      fprintf(stderr, "Max size is %d.\n", MAX_BOARD);
-	    fprintf(stderr, "Try `gnugo --help' for more information.\n");
+
+	  if (!check_boardsize(boardsize, stderr))
 	    exit(EXIT_FAILURE);
-	  }
+	  
 	  gnugo_clear_board(boardsize);
 	  break;
 	}
Index: engine/interface.c
===================================================================
--- engine/interface.c	(revision 2399)
+++ engine/interface.c	(working copy)
@@ -60,6 +60,27 @@
 
 /* ---------------------------------------------------------------- */
 
+/* Check whether we can accept a certain boardsize. Set out to NULL to
+ * suppress informative messages. Return 1 for an acceptable
+ * boardsize, 0 otherwise.
+ */
+int check_boardsize(int boardsize, FILE *out)
+{
+  if (boardsize < MIN_BOARD || boardsize > MAX_BOARD) {
+    if (out) {
+      fprintf(out, "Unsupported board size: %d. ", boardsize);
+      if (boardsize < MIN_BOARD)
+	fprintf(out, "Min size is %d.\n", MIN_BOARD);
+      else
+	fprintf(out, "Max size is %d.\n", MAX_BOARD);
+      fprintf(out, "Try `gnugo --help' for more information.\n");
+    }
+    return 0;
+  }
+
+  return 1;
+}
+
 /*
  * Clear the board.
  */
@@ -245,15 +266,9 @@
   
   if (!sgfGetIntProperty(tree->root, "SZ", &bs))
     bs = 19;
-  
-  if (bs < MIN_BOARD || bs > MAX_BOARD) {
-    if (bs < MIN_BOARD)
-      gprintf("Boardsize too small.\n");
-    else
-      gprintf("Boardsize too large.\n");
-    
+
+  if (!check_boardsize(bs, stderr))
     return EMPTY;
-  }
   
   handicap = 0;
   if (sgfGetIntProperty(tree->root, "HA", &handicap) && handicap > 1)
Index: engine/gnugo.h
===================================================================
--- engine/gnugo.h	(revision 2399)
+++ engine/gnugo.h	(working copy)
@@ -85,6 +85,7 @@
 /* ================================================================ */
 
 
+int check_boardsize(int boardsize, FILE *out);
 void gnugo_clear_board(int boardsize);
 void gnugo_play_move(int move, int color);
 int gnugo_play_sgfnode(SGFNode *node, int to_move);
