1999-04-07 16:01:30 +08:00
|
|
|
/* Conditionally execute a command based if the file argv[1] doesn't exist */
|
|
|
|
/* Except for execvp, we stick to ANSI C. */
|
Imported version version 6.0alpha7.
* README, README.Mac, README.OS2, README.QUICK, README.alpha,
README.amiga, README.debugging, README.dj, README.hp, README.linux,
README.rs6000, README.sgi, README.solaris2, README.uts,
README.win32, SCoptions.amiga, backptr.h, barrett_diagram,
dbg_mlc.h, gc.h, gc.man, gc_alloc.h, gc_cpp.h, gc_hdrs.h, gc_mark.h,
gc_priv.h, gc_private.h, gc_typed.h, gcconfig.h,
hpux_irix_threads.c, makefile.depend, nursery.c,
solaris_threads.h, test.c, test_cpp.cc, weakpointer.h, cord/README,
cord/SCOPTIONS.amiga, cord/SMakefile.amiga, cord/cord.h,
cord/ec.h, cord/gc.h, cord/private/cord_pos.h, include/backptr.h,
include/gc_copy_descr.h, include/gc_nursery.h: Remove obsolete/moved
files.
From-SVN: r42379
2001-05-21 16:35:14 +08:00
|
|
|
# include "private/gcconfig.h"
|
1999-04-07 16:01:30 +08:00
|
|
|
# include <stdio.h>
|
Imported version version 6.0alpha7.
* README, README.Mac, README.OS2, README.QUICK, README.alpha,
README.amiga, README.debugging, README.dj, README.hp, README.linux,
README.rs6000, README.sgi, README.solaris2, README.uts,
README.win32, SCoptions.amiga, backptr.h, barrett_diagram,
dbg_mlc.h, gc.h, gc.man, gc_alloc.h, gc_cpp.h, gc_hdrs.h, gc_mark.h,
gc_priv.h, gc_private.h, gc_typed.h, gcconfig.h,
hpux_irix_threads.c, makefile.depend, nursery.c,
solaris_threads.h, test.c, test_cpp.cc, weakpointer.h, cord/README,
cord/SCOPTIONS.amiga, cord/SMakefile.amiga, cord/cord.h,
cord/ec.h, cord/gc.h, cord/private/cord_pos.h, include/backptr.h,
include/gc_copy_descr.h, include/gc_nursery.h: Remove obsolete/moved
files.
From-SVN: r42379
2001-05-21 16:35:14 +08:00
|
|
|
# include <stdlib.h>
|
|
|
|
# include <unistd.h>
|
2004-08-14 07:05:36 +08:00
|
|
|
#ifdef __DJGPP__
|
|
|
|
#include <dirent.h>
|
|
|
|
#endif /* __DJGPP__ */
|
1999-04-07 16:01:30 +08:00
|
|
|
|
|
|
|
int main(argc, argv, envp)
|
|
|
|
int argc;
|
|
|
|
char ** argv;
|
|
|
|
char ** envp;
|
|
|
|
{
|
|
|
|
FILE * f;
|
2004-08-14 07:05:36 +08:00
|
|
|
#ifdef __DJGPP__
|
|
|
|
DIR * d;
|
|
|
|
#endif /* __DJGPP__ */
|
1999-04-07 16:01:30 +08:00
|
|
|
if (argc < 3) goto Usage;
|
|
|
|
if ((f = fopen(argv[1], "rb")) != 0
|
|
|
|
|| (f = fopen(argv[1], "r")) != 0) {
|
|
|
|
fclose(f);
|
|
|
|
return(0);
|
|
|
|
}
|
2004-08-14 07:05:36 +08:00
|
|
|
#ifdef __DJGPP__
|
|
|
|
if ((d = opendir(argv[1])) != 0) {
|
|
|
|
closedir(d);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
#endif
|
1999-04-07 16:01:30 +08:00
|
|
|
printf("^^^^Starting command^^^^\n");
|
Imported version version 6.0alpha7.
* README, README.Mac, README.OS2, README.QUICK, README.alpha,
README.amiga, README.debugging, README.dj, README.hp, README.linux,
README.rs6000, README.sgi, README.solaris2, README.uts,
README.win32, SCoptions.amiga, backptr.h, barrett_diagram,
dbg_mlc.h, gc.h, gc.man, gc_alloc.h, gc_cpp.h, gc_hdrs.h, gc_mark.h,
gc_priv.h, gc_private.h, gc_typed.h, gcconfig.h,
hpux_irix_threads.c, makefile.depend, nursery.c,
solaris_threads.h, test.c, test_cpp.cc, weakpointer.h, cord/README,
cord/SCOPTIONS.amiga, cord/SMakefile.amiga, cord/cord.h,
cord/ec.h, cord/gc.h, cord/private/cord_pos.h, include/backptr.h,
include/gc_copy_descr.h, include/gc_nursery.h: Remove obsolete/moved
files.
From-SVN: r42379
2001-05-21 16:35:14 +08:00
|
|
|
fflush(stdout);
|
1999-04-07 16:01:30 +08:00
|
|
|
execvp(argv[2], argv+2);
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
fprintf(stderr, "Usage: %s file_name command\n", argv[0]);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|