Set libbase and classdatatype.
[AROS-Contrib.git] / gc / if_not_there.c
blob42dd8034ac7e8d6021dd4a72aec7e038653250c5
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>
8 int main(argc, argv, envp)
9 int argc;
10 char ** argv;
11 char ** envp;
13 FILE * f;
14 if (argc < 3) goto Usage;
15 if ((f = fopen(argv[1], "rb")) != 0
16 || (f = fopen(argv[1], "r")) != 0) {
17 fclose(f);
18 return(0);
20 printf("^^^^Starting command^^^^\n");
21 fflush(stdout);
22 execvp(argv[2], argv+2);
23 exit(1);
25 Usage:
26 fprintf(stderr, "Usage: %s file_name command\n", argv[0]);
27 return(1);