$NetBSD$

--- src/looper.c.orig	Wed Jul 28 14:45:08 1999
+++ src/looper.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 #include "timeit.c"
+#include <sys/param.h>
 
 unsigned long iter;
 char *cmd_argv[28];
@@ -88,12 +89,34 @@
 		exit(2);
 		} 
 	else
+		{
 		/* master */
 		wait(&status);
-	if (status != 0) 
-		{
-		printf("Bad wait status: 0x%x\n", status);
-		exit(2);
+#if (defined(NetBSD) && (NetBSD < 199810))
+		/* NetBSD 1.3H and lower have a bug in dc */
+		if (strcmp(cmd_argv[0],"dc") != 0)
+			{
+			if (WIFSIGNALED(status))
+				{
+				printf("signaled: %d\n",WTERMSIG(status));
+				exit(2);
+				}
+				if (WIFEXITED(status))
+					{
+					if (WEXITSTATUS(status) != 0)
+						{
+						printf("Exit code: %d\n",WEXITSTATUS(status));
+						exit(2);
+						}
+					}
+			} /* NetBSD 1.3H */
+#else
+		if (status != 0) 
+			{
+			printf("Bad wait status: 0x%x\n", status);
+			exit(2);
+			}
+#endif
 		}
 	iter++;
 	}
