diff --git a/Makefile.am b/Makefile.am index fcf01ac..1a29e63 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,8 +9,8 @@ cmSRC += src/libcm/cmErr.c src/libcm/cmCtx.c src/libcm/cmRpt.c src/libcm/cmGloba cmHDR += src/libcm/cmSerialize.h src/libcm/cmSymTbl.h src/libcm/cmHashTbl.h src/libcm/cmFileSys.h src/libcm/cmFile.h cmSRC += src/libcm/cmSerialize.c src/libcm/cmSymTbl.c src/libcm/cmHashTbl.c src/libcm/cmFileSys.c src/libcm/cmFile.c -cmHDR += src/libcm/cmMem.h src/libcm/cmTime.h src/libcm/cmPgmOpts.h -cmSRC += src/libcm/cmMem.c src/libcm/cmTime.c src/libcm/cmPgmOpts.c +cmHDR += src/libcm/cmMem.h src/libcm/cmTime.h src/libcm/cmExec.h src/libcm/cmPgmOpts.h +cmSRC += src/libcm/cmMem.c src/libcm/cmTime.c src/libcm/cmExec.c src/libcm/cmPgmOpts.c cmHDR += src/libcm/cmData.h src/libcm/cmLib.h src/libcm/cmText.h src/libcm/cmTextTemplate.h cmSRC += src/libcm/cmData.c src/libcm/cmLib.c src/libcm/cmText.c src/libcm/cmTextTemplate.c diff --git a/cmExec.c b/cmExec.c new file mode 100644 index 0000000..c7b32f5 --- /dev/null +++ b/cmExec.c @@ -0,0 +1,81 @@ +#include "cmGlobal.h" +#include "cmRpt.h" +#include "cmErr.h" +#include "cmExec.h" +#include + +cmExRC_t cmExecV( cmErr_t* err, int* returnValRef, const cmChar_t* pgmFn, va_list vl0 ) +{ + cmExRC_t rc = kOkExRC; + int n = 0; + int i = 0; + pid_t pid; + va_list vl1; + + if( pgmFn == NULL ) + return cmErrMsg(err,kInvalidPgmFnExRC,"No executable program file name given in call to %s.",__FUNCTION__); + + // get the count of arguments + va_copy(vl1,vl0); + while( va_arg(vl1,cmChar_t*)!=NULL ) + ++n; + va_end(vl1); + + + // load argv with ptrs to the args + cmChar_t* argv[n+2]; + + argv[0] = (cmChar_t*)pgmFn; + for(i=0; i