1 /*******************************************************************************
2 * The BYTE UNIX Benchmarks - Release 1
3 * Module: looper.c SID: 1.4 5/15/91 19:30:22
5 *******************************************************************************
6 * Bug reports, patches, comments, suggestions should be sent to:
8 * Ben Smith or Tom Yager at BYTE Magazine
9 * ben@bytepb.byte.com tyager@bytepb.byte.com
11 *******************************************************************************
14 * February 25, 1991 -- created (Ben S.)
15 * October 22, 1997 - code cleanup to remove ANSI C compiler warnings
16 * Andy Kahn <kahn@zk3.dec.com>
18 ******************************************************************************/
19 char SCCSid
[] = "@(#) @(#)looper.c:1.4 -- 5/15/91 19:30:22";
21 * Shell Process creation
36 fprintf(stderr
,"COUNT|%lu|60|lpm\n", iter
);
40 int main(int argc
, char *argv
[])
42 int slave
, count
, duration
;
47 fprintf(stderr
,"Usage: %s duration command [args..]\n", argv
[0]);
48 fprintf(stderr
," duration in seconds\n");
52 if((duration
= atoi(argv
[1])) < 1)
54 fprintf(stderr
,"Usage: %s duration command [arg..]\n", argv
[0]);
55 fprintf(stderr
," duration in seconds\n");
61 for( count
=2;count
< argc
; ++count
)
62 cmd_argv
[count
-2]=argv
[count
];
64 printf("<<%s>>",cmd_argv
[0]);
65 for(count
=1;count
< cmd_argc
; ++count
)
66 printf(" <%s>", cmd_argv
[count
]);
72 wake_me(duration
, report
);
76 if ((slave
= fork()) == 0)
77 { /* execute command */
78 execvp(cmd_argv
[0],cmd_argv
);
84 fprintf(stderr
,"Fork failed at iteration %lu\n", iter
);
91 if (status
== 99 << 8)
93 fprintf(stderr
, "Command \"%s\" didn't exec\n", cmd_argv
[0]);
98 fprintf(stderr
,"Bad wait status: 0x%x\n", status
);