home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxtech07.zip / RXAWAR / VARPOOL / C / RUNMACRO.C < prev    next >
C/C++ Source or Header  |  1994-07-16  |  735b  |  36 lines

  1. /*
  2.  * runmacro.c -- Runs a rexx macro.
  3.  */
  4.  
  5. #include <os2.h>
  6. #include <rexxsaa.h>
  7.  
  8. BOOL RunMacro( PSZ filename, PCH argstring, ULONG len )
  9.   {
  10.     char     buf[ 256 ];
  11.     RXSTRING arglist[1];
  12.     APIRET   rc;
  13.     RXSTRING result;
  14.     SHORT    retcode;
  15.     ULONG    numargs = 1;
  16.  
  17.     result.strptr    = buf;
  18.     result.strlength = 256;
  19.  
  20.     arglist[0].strlength = len;
  21.     arglist[0].strptr    = argstring;
  22.  
  23.     if( len == 0 && argstring == NULL ){
  24.         numargs = 0;
  25.     }
  26.  
  27.     rc = RexxStart( numargs, arglist, filename, NULL, "CMD", RXCOMMAND,
  28.                     NULL, &retcode, &result );
  29.  
  30.     if( result.strptr != buf ){
  31.         DosFreeMem( result.strptr );
  32.     }
  33.  
  34.     return( rc == 0 );
  35.   }
  36.