]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/boehm_gc/if_not_there.c
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / src / engine / boehm_gc / if_not_there.c
1 /* Conditionally execute a command based if the file argv[1] doesn't exist */
2 /* Except for execvp, we stick to ANSI C. */
3 # include "private/gcconfig.h"
4 # include <stdio.h>
5 # include <stdlib.h>
6 # include <unistd.h>
7 #ifdef __DJGPP__
8 #include <dirent.h>
9 #endif /* __DJGPP__ */
10
11 int main(int argc, char **argv, char **envp)
12 {
13 FILE * f;
14 #ifdef __DJGPP__
15 DIR * d;
16 #endif /* __DJGPP__ */
17 if (argc < 3) goto Usage;
18 if ((f = fopen(argv[1], "rb")) != 0
19 || (f = fopen(argv[1], "r")) != 0) {
20 fclose(f);
21 return(0);
22 }
23 #ifdef __DJGPP__
24 if ((d = opendir(argv[1])) != 0) {
25 closedir(d);
26 return(0);
27 }
28 #endif
29 printf("^^^^Starting command^^^^\n");
30 fflush(stdout);
31 execvp(argv[2], argv+2);
32 exit(1);
33
34 Usage:
35 fprintf(stderr, "Usage: %s file_name command\n", argv[0]);
36 return(1);
37 }
38