Last change
on this file was 2135, checked in by bird, 20 years ago |
libc adjustments / config.
|
-
Property cvs2svn:cvs-rev
set to
1.2
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
838 bytes
|
Line | |
---|
1 | #include <stdio.h>
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <string.h>
|
---|
4 | #include <unistd.h>
|
---|
5 | #include <sys/stat.h>
|
---|
6 |
|
---|
7 |
|
---|
8 | static void do_prepare (void);
|
---|
9 | #define PREPARE(argc, argv) do_prepare ()
|
---|
10 | static int do_test (void);
|
---|
11 | #define TEST_FUNCTION do_test ()
|
---|
12 |
|
---|
13 | #include "../test-skeleton.c"
|
---|
14 |
|
---|
15 |
|
---|
16 | static char *fname;
|
---|
17 |
|
---|
18 | static void
|
---|
19 | do_prepare (void)
|
---|
20 | {
|
---|
21 | int fd = create_temp_file ("testscript", &fname);
|
---|
22 | #if 0
|
---|
23 | dprintf (fd, "echo foo\n");
|
---|
24 | fchmod (fd, 0700);
|
---|
25 | close (fd);
|
---|
26 | #else
|
---|
27 | FILE *pf = fdopen (fd, "w+");
|
---|
28 | fprintf (pf, "echo foo\n");
|
---|
29 | fflush (pf);
|
---|
30 | fchmod (fd, 0700);
|
---|
31 | fclose (pf);
|
---|
32 | #endif
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | static int
|
---|
37 | do_test (void)
|
---|
38 | {
|
---|
39 | if (setenv ("PATH", test_dir, 1) != 0)
|
---|
40 | {
|
---|
41 | puts ("setenv failed");
|
---|
42 | return 1;
|
---|
43 | }
|
---|
44 |
|
---|
45 | char *argv[] = { fname, NULL };
|
---|
46 | execvp (basename (fname), argv);
|
---|
47 |
|
---|
48 | /* If we come here, the execvp call failed. */
|
---|
49 | return 1;
|
---|
50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.