|
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:
706 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 | dprintf (fd, "echo foo\n");
|
|---|
| 23 | fchmod (fd, 0700);
|
|---|
| 24 | close (fd);
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | static int
|
|---|
| 29 | do_test (void)
|
|---|
| 30 | {
|
|---|
| 31 | if (setenv ("PATH", test_dir, 1) != 0)
|
|---|
| 32 | {
|
|---|
| 33 | puts ("setenv failed");
|
|---|
| 34 | return 1;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | char *argv[] = { fname, NULL };
|
|---|
| 38 | execvp (basename (fname), argv);
|
|---|
| 39 |
|
|---|
| 40 | /* If we come here, the execvp call failed. */
|
|---|
| 41 | return 1;
|
|---|
| 42 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.