6 char actual[sizeof sample];
15 printf ("(multi-child-fd) begin\n");
17 handle = open("sample.txt");
19 printf ("(multi-child-fd) fail: open() returned %d\n", handle);
21 snprintf (child_cmd, sizeof child_cmd, "child-close %d", handle);
23 printf ("(multi-child-fd) wait(exec()) = %d\n", wait (exec (child_cmd)));
25 byte_cnt = read (handle, actual, sizeof actual - 1);
26 if (byte_cnt != sizeof actual - 1)
27 printf ("(multi-child-fd) fail: read() returned %d instead of %d\n",
28 byte_cnt, sizeof actual - 1);
29 else if (strcmp (sample, actual))
30 printf ("(multi-child-fd) fail: expected text differs from actual:\n%s",
33 printf ("(multi-child-fd) end\n");