semtimedop implementation for Linux/m68k.
[glibc.git] / linuxthreads / tst-popen.c
blobf76a6e79e5389cbd005c6e759b6051384b866b82
1 #include <errno.h>
2 #include <error.h>
3 #include <pthread.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <unistd.h>
9 static void *
10 dummy (void *x)
12 return NULL;
15 static char buf[sizeof "something\n"];
17 static int
18 do_test (void)
20 FILE *f;
21 pthread_t p;
23 pthread_create (&p, NULL, dummy, NULL);
24 f = popen ("echo something", "r");
25 if (f == NULL)
26 error (EXIT_FAILURE, errno, "popen failed");
27 if (fgets (buf, sizeof (buf), f) == NULL)
28 error (EXIT_FAILURE, 0, "fgets failed");
29 if (strcmp (buf, "something\n"))
30 error (EXIT_FAILURE, 0, "read wrong data");
31 if (pclose (f))
32 error (EXIT_FAILURE, errno, "pclose returned non-zero");
33 exit (0);
36 #define TEST_FUNCTION do_test ()
37 #include "../test-skeleton.c"