home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / pipdos11.zip / _pd.c next >
Text File  |  1995-07-05  |  680b  |  27 lines

  1. /* PipeDOSD: Run a dos command/program and redirect the output  */
  2. /*           to a pipe specified in argp[1].            */
  3.  
  4. #include <process.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <io.h>
  8. #include <fcntl.h>
  9. #include <sys\stat.h>
  10.  
  11. int main(int argc, char **argp)
  12. {
  13.    int result;
  14.    FILE *f;
  15.    if (argc < 2) {
  16.      printf("This program is meant to be called by PipeDOS.exe in an OS/2 session.\n");
  17.      exit(1);
  18.    }
  19.    freopen("/pipe/pipedos.0","r",stdin);
  20.    freopen("/pipe/pipedos.1","w",stdout);
  21.    freopen("/pipe/pipedos.2","w",stderr);
  22.    result = spawnvp(P_WAIT,argp[1], &argp[1]);
  23.    fclose(stdout);
  24.    fclose(stderr);
  25.    return result;
  26. }
  27.