shithub: moonfish

Download patch

ref: 06cb1082b7b827cbdcc0c68e07ea57d6b7a97ff1
parent: 2da5dd839df4bce50b6da96bf856c305de4509f8
author: zamfofex <zamfofex@twdb.moe>
date: Sun Apr 21 20:24:25 EDT 2024

do not exit upon ‘strtol’ failure

--- a/main.c
+++ b/main.c
@@ -80,12 +80,7 @@
 					
 					errno = 0;
 					*xtime = strtol(arg, &end, 10);
-					if (errno != 0)
-					{
-						perror(argv[0]);
-						return 1;
-					}
-					if (*end != 0 || *xtime < 0)
+					if (errno != 0 || *end != 0 || *xtime < 0)
 					{
 						fprintf(stderr, "%s: malformed time in 'go' command\n", argv[0]);
 						return 1;
--- a/tools/perft.c
+++ b/tools/perft.c
@@ -54,12 +54,7 @@
 	
 	errno = 0;
 	depth = strtol(args[1].value, &end, 10);
-	if (errno != 0)
-	{
-		perror(argv[0]);
-		return 1;
-	}
-	if (*end != 0 || depth < 0 || depth >= 24)
+	if (errno != 0 || *end != 0 || depth < 0 || depth >= 24)
 		moonfish_usage(args, format, argv[0]);
 	
 	moonfish_chess(&chess);
--