remove extra mkfs.1
[minix.git] / test / test13.c
blob9ab4dd1650244cbb63083c102da65cd145b5fda8
1 /* test 13 */
3 /* File: pipes.c - created by Marty Leisner */
4 /* Leisner.Henr 1-Dec-87 8:55:04 */
6 /* Copyright (C) 1987 by Martin Leisner. All rights reserved. */
7 /* Used by permission. */
9 #include <sys/types.h>
10 #include <sys/wait.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <stdio.h>
15 #define BLOCK_SIZE 1000
16 #define NUM_BLOCKS 1000
18 char buffer[BLOCK_SIZE];
20 #define MAX_ERROR 2
21 #include "common.c"
23 int main(void);
24 void quit(void);
26 int main()
28 int stat_loc, pipefd[2];
29 register int i;
31 start(13);
33 pipe(pipefd);
35 switch (fork()) {
36 case 0:
37 /* Child code */
38 for (i = 0; i < NUM_BLOCKS; i++)
39 if (read(pipefd[0], buffer, BLOCK_SIZE) != BLOCK_SIZE) break;
40 exit(0);
42 case -1:
43 perror("fork broke");
44 exit(1);
46 default:
47 /* Parent code */
48 for (i = 0; i < NUM_BLOCKS; i++) write(pipefd[1], buffer, BLOCK_SIZE);
49 wait(&stat_loc);
50 break;
52 quit();
53 return(-1); /* impossible */