]> gcc.gnu.org Git - gcc.git/blob - boehm-gc/if_not_there.c
Return earlier if not effective_target_int32
[gcc.git] / 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(argc, argv, envp)
12 int argc;
13 char ** argv;
14 char ** envp;
15 {
16 FILE * f;
17 #ifdef __DJGPP__
18 DIR * d;
19 #endif /* __DJGPP__ */
20 if (argc < 3) goto Usage;
21 if ((f = fopen(argv[1], "rb")) != 0
22 || (f = fopen(argv[1], "r")) != 0) {
23 fclose(f);
24 return(0);
25 }
26 #ifdef __DJGPP__
27 if ((d = opendir(argv[1])) != 0) {
28 closedir(d);
29 return(0);
30 }
31 #endif
32 printf("^^^^Starting command^^^^\n");
33 fflush(stdout);
34 execvp(argv[2], argv+2);
35 exit(1);
36
37 Usage:
38 fprintf(stderr, "Usage: %s file_name command\n", argv[0]);
39 return(1);
40 }
41
This page took 0.03735 seconds and 5 git commands to generate.