source: trunk/minix/test/test12.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 880 bytes
RevLine 
[9]1/* test 12 */
2
3/* Copyright (C) 1987 by Martin Leisner. All rights reserved. */
4/* Used by permission. */
5
6#include <sys/types.h>
7#include <sys/wait.h>
8#include <stdlib.h>
9#include <unistd.h>
10#include <stdio.h>
11
12#define NUM_TIMES 1000
13
14int errct = 0;
15
16_PROTOTYPE(int main, (void));
17_PROTOTYPE(void quit, (void));
18
19int main()
20{
21 register int i;
22 int k;
23
24 printf("Test 12 ");
25 fflush(stdout); /* have to flush for child's benefit */
26
27 system("rm -rf DIR_12; mkdir DIR_12");
28 chdir("DIR_12");
29
30 for (i = 0; i < NUM_TIMES; i++) switch (fork()) {
31 case 0: exit(1); break;
32 case -1:
33 printf("fork broke\n");
34 exit(1);
35 default: wait(&k); break;
36 }
37
38 quit();
39 return(-1); /* impossible */
40}
41
42void quit()
43{
44
45 chdir("..");
46 system("rm -rf DIR*");
47
48 if (errct == 0) {
49 printf("ok\n");
50 exit(0);
51 } else {
52 printf("%d errors\n", errct);
53 exit(1);
54 }
55}
Note: See TracBrowser for help on using the repository browser.