/* * Screen to stream converter and vice versa * used to filter screen files for CVS * written in C, so that I can run it on systems without installing Forth */ #include #include #include #define B_BLK 0x400 #define C_L 0x40 int backscan(char * block, int n, char c) { for(n--; n>=0 && (block[n] == c); n--); return n < 0 ? 0 : n + (block[n] != c); } int ctrlmask(char * p, char * o, int n) { int i, k=0; for(i=0; i 1) { if(strcmp(argv[1], "-")) { if(!(in = fopen(argv[1], "rb"))) { fprintf(stderr, "Error opening input file: %s\n", strerror(errno)); return -1; } } } if(argc > 2) { if(!(out = fopen(argv[2], "wb"))) { fprintf(stderr, "Error opening output file: %s\n", strerror(errno)); return -1; } } if(what) scr2str(in, out); else str2scr(in, out); return 0; }