Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Mar 1995 09:36:15 +0100 (MET)
From:      Thomas Gellekum <thomas@ghpc8.ihf.rwth-aachen.de>
To:        bugs@FreeBSD.org
Subject:   diffs for boggle
Message-ID:  <199503230836.JAA02166@ghpc6.ihf.rwth-aachen.de>

next in thread | raw e-mail | index | archive | help
Moin moin,

looks like strcmp() and strlen() don't like NULL's as arguments.

The attached diffs should be applied in /usr/src/games/boggle/boggle.

tg

diff -c /usr/src/games/boggle/boggle/bog.c ./bog.c
*** /usr/src/games/boggle/boggle/bog.c	Sun Sep  4 06:02:31 1994
--- ./bog.c	Wed Mar 22 16:10:46 1995
***************
*** 119,125 ****
  	int argc;
  	char *argv[];
  {
! 	long seed;
  	int ch, done, i, selfuse, sflag;
  	char *bspec, *p;
  
--- 119,125 ----
  	int argc;
  	char *argv[];
  {
! 	long seed = 0;
  	int ch, done, i, selfuse, sflag;
  	char *bspec, *p;
  
***************
*** 155,174 ****
  	argc -= optind;
  	argv += optind;
  
! 	if (strcmp(argv[0], "+") == 0)
! 		reuse = 1;
! 	else if (strcmp(argv[0], "++") == 0)
! 		selfuse = 1;
! 	else if (islower(argv[0][0])) {
! 		if (strlen(argv[0]) != 16) {
! 			usage();
! 
! 			/* This board is assumed to be valid... */
! 			bspec = argv[0];
! 		} else
! 			usage();
! 	}
  
  	if (batch && bspec == NULL)
  		errx(1, "must give both -b and a board setup");
  
--- 155,175 ----
  	argc -= optind;
  	argv += optind;
  
!         if (argv[0]) {      /* any args left? */
! 	        if (strcmp(argv[0], "+") == 0)
! 		        reuse = 1;
!         	else if (strcmp(argv[0], "++") == 0)
! 	        	selfuse = 1;
!         	else if (islower(argv[0][0])) {
! 	        	if (strlen(argv[0]) != 16) {
! 		        	usage();
  
+ 	        	} else
+ 			        /* This board is assumed to be valid... */
+         			bspec = argv[0];
+         	}
+         }
+         
  	if (batch && bspec == NULL)
  		errx(1, "must give both -b and a board setup");
  
diff -c /usr/src/games/boggle/boggle/timer.c ./timer.c
*** /usr/src/games/boggle/boggle/timer.c	Sun Sep  4 06:02:31 1994
--- ./timer.c	Wed Mar 22 14:20:51 1995
***************
*** 45,50 ****
--- 45,51 ----
  #include <setjmp.h>
  #include <stdio.h>
  #include <unistd.h>
+ #include <string.h>
  
  #include "bog.h"
  #include "extern.h"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503230836.JAA02166>