home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* DISPHR.C */
- /* */
- /* This program provides for the local display of high res */
- /* images transmitted by CompuServe. */
- /* */
- /* Format: */
- /* disphr <filename> */
- /* */
- /* where <filename> is the name of the file that */
- /* contains the captured high res text from CIS */
- /* */
- /* */
- /************************************************************************/
-
- #include <stdio.h>
-
- main(argc,argv)
- int argc;
- char **argv;
- {
- char l[132];
- FILE *fopen(),*inf;
- int c;
- int curcol,currow,temp;
- int black,white,white2,i,j;
-
- curcol=0;
- currow=0;
-
- if (argc != 2) {
- printf("usage: disphr <file>\n");
- exit(1);
- }
-
- inf =fopen(argv[1],"rb");
- if (inf == NULL) {
- printf("Unable to open %s\n",argv[1]);
- return;
- }
-
- crt_mode(5);
-
- while ('\033' != (c = getc(inf)));
- getc(inf); /* G */
- getc(inf); /* H */
-
- for (;;) {
- black = (getc(inf) & 0x7f) - 32;
- if (black <0) {
- goto pr;
- }
-
- white = (getc(inf) & 0x7f) - 32;
- if (white < 0) {
- goto pr;
- }
- curcol = curcol + black;
- if (curcol>=256) {
- curcol = curcol - 256;
- currow++;
- }
-
- do {
- white2 = 0;
- if ((curcol+white)>=256) {
- white2 = white+curcol-256;
- white = 256-curcol;
- }
- for (i=curcol;i<(curcol+white);i++) {
- crt_wdot(currow,i,3);
- }
- curcol = curcol+white;
- if (curcol == 256) {
- curcol = 0;
- currow++;
- }
- white = white2;
- } while (white != 0);
-
- }
- pr:
- crt_srcp(24,0,0);
- printf("Press return: ");
- gets(l,132,stdin);
- crt_mode(2);
- }
-