bob@consult.UUCP (Bob Willey) (10/15/90)
Subject: screen dump # Bourne sheel script to write the screen # to standard output # # zdump > file # zdump | lp # # are good examples of how to use this # stty -echo ixon /bin/echo '\033[2i' 1>&2 cat - | { while read a do echo $a done } stty echo This appears to work, BUT: We have to abort to end, and the tty need to be reset - stty echo to get the echo back. -- >.. CCS Enterprises, Inc. .. Bob Willey, CDP ..< >.. P.O. Drawer 1690 .. uunet!consult!bob ..< >.. Easton, Maryland 21601 .. (301) 820-4670 ..< >.......................BBS: (301) 476-5098.....................<
chip@chinacat.Unicom.COM (Chip Rosenthal) (10/15/90)
In article <210@consult.UUCP> bob@consult.UUCP (Bob Willey) writes: >Followup-To: poster Give me a freaking break. >Subject: screen dump ># Bourne sheel script to write the screen ># to standard output I posted a "prtscrn" utility to comp.unix.xenix a few months back for Herc displays. I hacked on it a bit, and have a version which should run in all text modes. It's been tested on ODT as well as XENIX. Usage would be something along the lines of "prtscrn 3 > /tmp/screen.dump" to save the contents of screen 3 to a file. This is not a clean & polished program - just a quick hack which does the trick. It works by slurping in the text directly from the display adapter memory. --- cut here ----------------------------------------------------------------- #include <stdio.h> #include <fcntl.h> #include <sys/machdep.h> #define USAGE "usage: %s [screen_num]\n" #define SCREENS 12 struct { int s_code; int s_cols; int s_lines; } scrtab[] = { { M_B40x25, 40, 25 }, { M_C40x25, 40, 25 }, { M_B80x25, 80, 25 }, { M_C80x25, 80, 25 }, { M_BG320, -1, -1 }, { M_CG320, -1, -1 }, { M_BG640, -1, -1 }, { M_EGAMONO80x25, 80, 25 }, { M_CG320_D, -1, -1 }, { M_CG640_E, -1, -1 }, { M_EGAMONOAPA, -1, -1 }, { M_CG640x350, -1, -1 }, { M_ENHMONOAPA2, -1, -1 }, { M_ENH_CG640, -1, -1 }, { M_ENH_B40x25, 40, 25 }, { M_ENH_C40x25, 40, 25 }, { M_ENH_B80x25, 80, 25 }, { M_ENH_C80x25, 80, 25 }, { M_VGA_40x25, 40, 25 }, { M_VGA_80x25, 80, 25 }, { M_VGA_M80x25, 80, 25 }, { M_VGA11, -1, -1 }, { M_VGA12, -1, -1 }, { M_VGA13, -1, -1 }, { M_ENH_B80x43, 80, 43 }, { M_ENH_C80x43, 80, 43 }, { M_HGC_P0, -1, -1 }, { M_HGC_P1, -1, -1 }, { M_MCA_MODE, -1, -1 }, { -1, -1, -1 }, }; main(argc,argv) int argc; char *argv[]; { char *disp_mem, scrname[64]; int screen_num, disp_mode, disp_fd, num_cols, num_lines, line, col, i; switch ( argc ) { case 1: screen_num = 0; strcpy(scrname,"/dev/tty"); break; case 2: screen_num = atoi(argv[1]); if ( screen_num < 1 || screen_num > SCREENS ) { fprintf(stderr,"%s: bad screen number specified\n",argv[0]); exit(1); } sprintf(scrname,"/dev/tty%02d",screen_num); fprintf(stderr,"\033[%dz",screen_num-1); fflush(stderr); break; default: fprintf(stderr,USAGE,argv[0]); exit(1); } if ( (disp_fd=open(scrname,O_RDWR)) < 0 ) { fprintf(stderr,"%s: could not open '%s'\n",argv[0],scrname); exit(1); } if ( (disp_mode=ioctl(disp_fd,CONS_GET,0)) < 0 ) { fprintf(stderr,"%s: could not get display type\n",argv[0]); exit(1); } if ( (disp_mem=(char *)ioctl(disp_fd,MAPCONS,0)) == NULL ) { fprintf(stderr,"%s: could not map display memory\n",argv[0]); exit(1); } for ( i=0 ; scrtab[i].s_code>=0 && scrtab[i].s_code!=disp_mode ; ++i ) ; num_cols = scrtab[i].s_cols; num_lines = scrtab[i].s_lines; if ( num_cols < 0 || num_lines < 0 ) { fprintf(stderr,"%s: display not in supported text mode\n",argv[0]); exit(1); } for ( line = 0 ; line < num_lines ; ++line ) { for ( col = 0 ; col < num_cols ; ++col ) { putchar(*disp_mem); disp_mem += 2; } putchar('\n'); } exit(0); } --- cut here ----------------------------------------------------------------- -- Chip Rosenthal <chip@chinacat.Unicom.COM> Unicom Systems Development, 512-482-8260 Our motto is: We never say, "But it works with DOS."