home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / PROG / C_PLUS / CNVLIB2 / TEE.CMD < prev    next >
Encoding:
Text File  |  1993-11-05  |  995 b   |  36 lines

  1. @echo OFF
  2. REM ****************************************************
  3. REM *** Tee.cmd - Capture text-mode screen output of ***
  4. REM ***           a command to a file                ***
  5. REM ****************************************************
  6.  
  7. if not "%2"=="" GOTO DO_TEE
  8. ECHO Tee.cmd - Pipe command output to screen AND to a file
  9. ECHO USAGE: Tee CaptureFile Commands....
  10. ECHO WHERE: CaptureFile - Name of file to capture text to
  11. ECHO        Commands - Any executable commands
  12. ECHO EXAMPLE: Tee DirSave.txt dir *.exe
  13. GOTO TEE_DONE
  14.  
  15. :DO_TEE
  16. %2 %3 %4 %5 %6 %7 %8 %9 | CEnvi %0.cmd %1
  17. GOTO CENVI_EXIT
  18.  
  19. main(argc,argv)
  20. {
  21.    fp = fopen(argv[1],"w");    // open file for output
  22.    if ( !fp )
  23.       printf("Could not open file \"%s\" for output\n",argv[1]);
  24.    else {
  25.       // read in each line, and send to file and screen
  26.       while ( line=gets() ) {
  27.          printf("%s\n",line)
  28.          fprintf(fp,"%s\n",line)
  29.       }
  30.       fclose(fp)
  31.    }
  32. }
  33.  
  34. :CENVI_EXIT
  35. :TEE_DONE
  36.