libming/libming — Issue #3: test/actionscript/ActionScriptTest.c fails on OpenBSD 4.9
Author: ehy
Created: 2011-12-06 17:52:56+00:00
State: open

Apparently BSD and GNU make treat macros differently.
ActionScriptTest.c loops over test cases from a string that
originates in a Makefile macro; and expects ' ' (space)
separators. Using isspace() lets the test run as expected.
(This is likely the same for any *BSD.)

diff -u:
--- test/actionscript/ActionScriptTest.c-orig	2011-10-26 02:33:18.000000000 -0400
+++ test/actionscript/ActionScriptTest.c	2011-12-06 10:28:06.000000000 -0500
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include

static SWFMovie
@@ -82,18 +83,26 @@
const char *from, *to, *end;
char *ptr;
int version;
+	size_t len = strlen(all_tests);

from = all_tests;
-	end = from+strlen(all_tests);
+	end = from+len;
do
{
-	while (*from && *from == ' ') ++from;
+	/* EH: for BSD make, change test ' ' to isspace() */
+	while (*from && isspace(*from)) ++from;
if ( ! *from ) break;

-	to=strchr(from, ' ');
+	/* strtok()? too much trouble */
+	for (to = from; !isspace(*to); to++) {
+	if (*to == '\0') {
+	to = NULL;
+	break;
+	}
+	}
if ( ! to ) to = end;

-	size_t len = to-from;
+	len = to-from;
if ( len+1 >= PATH_MAX )
{
fprintf(stderr,