summaryrefslogtreecommitdiff
path: root/benchmarks/bytebench/patches/patch-ac
blob: ee079a45f4c021026d887cf07213cb4cd9e5f934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$NetBSD: patch-ac,v 1.2 2000/01/05 12:23:56 agc Exp $

--- src/looper.c.orig	Sat May 13 20:32:00 1995
+++ src/looper.c	Wed Jan  5 12:17:10 2000
@@ -22,6 +22,9 @@
 
 #include <stdio.h>
 #include "timeit.c"
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <sys/param.h>
 
 unsigned long iter;
 char *cmd_argv[28];
@@ -84,14 +87,30 @@
 		perror("Reason");
 		exit(2);
 		} 
-	else
+	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
+	     }  /* else */
 	iter++;
 	}
 }