home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
arc
/
arca-sub.lzh
/
ARCA-SUB.C
next >
Wrap
C/C++ Source or Header
|
1989-01-27
|
1KB
|
36 lines
/* Runs another program with additional arguments. Written using MSC 5.1 */
/* Another one from Planet Terus :-) */
#include <stdio.h>
#include <process.h>
#include <string.h>
#define THE_PROGRAM "PAK.EXE" /* desired program name */
#define MAX_ARGS 16 /* maximum arguments */
#define NEW_ARGS "a /c /o-" /* new 1st argument */
#define MOVE_ARG "m /c /o-"
main (int argc, char *argv[])
{
char *alt_args [MAX_ARGS];
int i;
argc; /* ref so we don't get warning */
for (i = 1; argv [i] ; )
alt_args [i+1] = argv [i++];
alt_args [0] = THE_PROGRAM; /* desired program */
alt_args [1] = NEW_ARGS; /* new 1st argument */
alt_args [++i] = NULL; /* null terminate arg list */
if (!stricmp(alt_args[i-1],"/d"))
{
alt_args[1] = MOVE_ARG;
alt_args[i-1] = NULL;
}
return (execvp (THE_PROGRAM, alt_args));
}