Last change
on this file was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
758 bytes
|
Line | |
---|
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>
|
---|
8 |
|
---|
9 | static void *
|
---|
10 | dummy (void *x)
|
---|
11 | {
|
---|
12 | return NULL;
|
---|
13 | }
|
---|
14 |
|
---|
15 | static char buf[sizeof "something\n"];
|
---|
16 |
|
---|
17 | static int
|
---|
18 | do_test (void)
|
---|
19 | {
|
---|
20 | FILE *f;
|
---|
21 | pthread_t p;
|
---|
22 |
|
---|
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);
|
---|
34 | }
|
---|
35 |
|
---|
36 | #define TEST_FUNCTION do_test ()
|
---|
37 | #include "../test-skeleton.c"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.