C:/Users/Dennis/src/lang/russell.orig/src/gc/if_not_there.c

Go to the documentation of this file.
00001 /* Conditionally execute a command based if the file argv[1] doesn't exist */
00002 /* Except for execvp, we stick to ANSI C.                                  */
00003 # include "config.h"
00004 # include <stdio.h>
00005 
00006 int main(argc, argv, envp)
00007 int argc;
00008 char ** argv;
00009 char ** envp;
00010 {
00011     FILE * f;
00012     if (argc < 3) goto Usage;
00013     if ((f = fopen(argv[1], "rb")) != 0
00014         || (f = fopen(argv[1], "r")) != 0) {
00015         fclose(f);
00016         return(0);
00017     }
00018     execvp(argv[2], argv+2);
00019     
00020 Usage:
00021     fprintf(stderr, "Usage: %s file_name command\n", argv[0]);
00022     return(1);
00023 }

Generated on Fri Jan 25 10:39:45 2008 for russell by  doxygen 1.5.4