/* Colrview.c - views file on screen and optionally sends to JX-80 printer. 02/19/85 by Ward Christensen TEST VERSION - not really ready for prime time... Uses \x type imbeds in a file to select colors. A single space is printed every time a \ is encountered. The character following the \ picks the color or function: n normal (black) r red b blue g green y yellow p purple o orange m turn off colors from here on */ #include "stdio.h" #define MAXLEN 160 int printer,parm,mono,i; FILE *fi,*pr; main(argc,argv) int argc; char *argv[]; { char c, line[MAXLEN], *p; printer=0; mono=0; bwhite();green(); printf("Color");blue();printf("view");yellow(); printf(" Version 1.0, 2/16/85 by Ward Christensen\n"); black(); if (argc==1) { fputs("Usage: colrview [-options] filename\n", stderr); fputs("Options: (m)ono, (c)ondensed, (p)rinter\n", stderr); fputs(" (s)uperscript [to even ribbon wear]\n", stderr); fputs(" ex: colrview -pc test.txt\n", stderr); fputs(" (option p must precede option c)\n", stderr); fputs("Color display & ANSI.SYS req'd.\n", stderr); exit(1); } parm=1; if(argv[1][0]=='-') { ++parm; /* so file open gets filename */ for(i=1;i0 if output is to go to the printer mono >1 if printer is in monochrome mode. */ nor() { printf("\033[0m"); } /* note resets background to black */ high() { printf("\033[1m"); } revvid() { printf("\033[7m"); } black() { printf("\033[30m"); if(printer) lprintf("\033r0"); } red() { if(mono) return(0); printf("\033[31m"); if(printer) lprintf("\033r1"); } green() { if(mono) return(0); printf("\033[32m"); if(printer) lprintf("\033r6"); } yellow() { if(mono) return(0); printf("\033[33m"); if(printer) lprintf("\033r4"); } blue() { if(mono) return(0); printf("\033[34m"); if(printer) lprintf("\033r2"); } magenta() { if(mono) return(0); printf("\033[35m"); if(printer) lprintf("\033r3"); } cyan() { if(mono) return(0); printf("\033[36m"); if(printer) lprintf("\033r2"); } white() { if(mono) return(0); printf("\033[37m"); if(printer) lprintf("\033r0"); } orange() { if(mono) return(0); nor();bwhite(); printf("\033[33m"); if(printer) lprintf("\033r5"); } bblack() { printf("\033[40m"); } bred() { printf("\033[41m"); } bgreen() { printf("\033[42m"); } byellow() { printf("\033[43m"); } bblue() { printf("\033[44m"); } bmagenta() { printf("\033[45m"); } bcyan() { printf("\033[46m"); } bwhite() { printf("\033[47m"); }  ntf("\033[44m"); } bmagenta() { printf(