From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 25-AUG-1993 11:00:24.74
To:	EVERHART
CC:	
Subj:	RE: Recording VMS sessions without PHOTO

Date: Tue, 17 Aug 1993 14:46:55 -0700 (PDT)
From: The Ghost in the Machine <RICH@vax5.csd.com>
To: INFO-VAX@sri.com
Cc: RICH@vax5.csd.com
Message-Id: <930817144655.32a01727@vax5.csd.com>
Subject: RE: Recording VMS sessions without PHOTO


>Does anyone know of a "screen snapshot"-style system of recording VMS sessions
>on VT series terminals?  We need something that will reassemble the screen
>image as text, disregarding the escape sequences.

We use the following program, RINSE.C, to remove the escape sequences from the
output files produced by PHOTO.  

/*  The following program finds and deletes or replaces
 *  control sequences from photo.dat files.
 *
 * To run RINSE as a command with parameters passed to it from the DCL command
 * level, the command must first be installed as a foreign command. This can be
 * done in the login.com file by including something similar to the following 
 * DCL line:
 *
 * $ rinse == "$ disk:[directory]rinse.exe"
 * 
 * After this command has been installed, the parameter sequence for RINSE is
 *
 * $ RINSE INPUT_FILE_SPEC OUTPUT_FILE_SPEC
 * 
 * This command will run RINSE using the two input and output files named.
 *
 */

#include ctype
#include stdio
#include stdlib
#include string

FILE *fp1,*fp2;
char buffer1[256], buffer2[256];

main(argc,argv)
int argc;
char *argv[];
{
  char c;
  int i,j,k;

  printf("\nRINSE version 0.2, R.P. Yanda 9/1/89");

  fp1 = fopen(argv[1],"r");
  if(!fp1){
    printf("\nINPUT FILE NOT FOUND");
    return;
  }

  fp2 = fopen(argv[2],"w");
  while (!feof(fp1)){
    for(i=0,j=0;i<256;i++,j++){
      buffer1[i] = 0x00;
      buffer2[j] = 0x00;
    }
    fgets(buffer1,256,fp1);
    for(i=0,j=0;i<255;i++){
      k = 0;
      switch(buffer1[i]){
        case 0x08:
          j--;
        break;
        case 0x1B:                                /* esc */
          switch(buffer1[i+1]){
            case '[':                            /* start esc[  */
              switch(buffer1[i+2]){
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'H':
                case 'K': 
                case 'm':
                  k = 2;
                break;
                case '7':
                  if(buffer1[i+3] == 'm') k = 3;
                break;
                case '2':
                  if(buffer1[i+3] == 'J') k = 3;
                break;
              }
            break;
            case '7':
            case '8':
              k = 1;
            break;
            default:
              k = 0;
            break;
          }
        break;
        default:
            if(isprint(buffer1[i]) || buffer1[i]==0x0A || buffer1[i]== 0x0D){
              buffer2[j] = buffer1[i];
              j++;
            }
        break;
      }
      i += k;
      k = 0;
          
    }      /* endfor */
    fputs(buffer2,fp2);
  }        /* endwhile */

  fclose(fp1);
  fclose(fp2);

}  /* endmain */


