home *** CD-ROM | disk | FTP | other *** search
- 1 /*
- 2 * dosexec.c ----- Spawns a synchronous OS/2 process
- 3 */
- 4
- 5 #include <doscall.h>
- 6 #include <stdio.h>
- 7 #include <string.h>
- 8
- 9 #define WAIT (unsigned) 0
- 10 #define NO_WAIT_DONT_CARE (unsigned) 1
- 11 #define NO_WAIT_CARE (unsigned) 2
- 12 #define PTRACE (unsigned) 3
- 13 #define DAEMON (unsigned) 4
- 14
- 15 char FailString[64]; /* Place for name of load object on error */
- 16 char far *FSptr = FailString; /* Ptr to Fail String buffer */
- 17 unsigned FSLength = sizeof FailString; /* Length of failure string */
- 18 unsigned ExecType; /* Wait,
- 19 NoWaitDontCare, NoWaitCare,
- 20 Ptrace,
- 21 Daemon */
- 22 char ArgString[64]; /* Argument string */
- 23 char far *ASptr = ArgString; /* Far ptr needed for DosExecPgm() */
- 24 char EnvString[64]; /* Environment Space string */
- 25 char far *ESptr = EnvString; /* Far ptr needed for DosExecPgm() */
- 26 char Pgm[64]; /* Program to be exec'ed */
- 27 char far *Pptr = Pgm; /* Far ptr needed for DosExecPgm() */
- 28
- 29 struct ResultCodes RetCode; /* For return code from DosExecPgm() */
- 30 struct ResultCodes far *RCptr = &RetCode;
- 31
- 32 main()
- 33 {
- 34 char *offset;
- 35
- 36 strcpy(Pgm, "frank.exe"); /* Want to run 'frank.exe' */
- 37 ESptr = (char far *) NULL; /* Inherit Parent's environment */
- 38
- 39 strcpy(ArgString, "frank.exe"); /* First string is pgm name */
- 40
- 41 offset = ArgString + strlen("frank.exe");
- 42 *offset = NULL; /* Separate the two strings */
- 43 strcpy(offset+1, "-d file"); /* Second string - the cmd line arguments */
- 44
- 45 /* Now that everything is setup...go and do it. */
- 46
- 47 DosExecPgm(FSptr, FSLength, WAIT, ASptr, ESptr, RCptr, Pptr);
- 48 }
-