home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume33 / prtscrn2 / patch01 next >
Text File  |  1992-11-02  |  10KB  |  273 lines

  1. Newsgroups: comp.sources.misc
  2. From: Chip Rosenthal <chip@chinacat.unicom.com>
  3. Subject:  v33i029:  prtscrn2 - screen dump utility for SCO UNIX/XENIX, Patch01
  4. Message-ID: <1992Nov1.225933.26965@sparky.imd.sterling.com>
  5. X-Md4-Signature: b6100260447f85806d1714fc50d54ded
  6. Date: Sun, 1 Nov 1992 22:59:33 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Chip Rosenthal <chip@chinacat.unicom.com>
  10. Posting-number: Volume 33, Issue 29
  11. Archive-name: prtscrn2/patch01
  12. Environment: SCO
  13. Patch-To: prtscrn2: Volume 30, Issue 76
  14.  
  15. `Prtscrn' grabs the contents of an SCO Unix or Xenix console screen
  16. and sends them to stdout -- for saving to a file, printing, etc.
  17.  
  18. This patch is of interest primarly to SCO Xenix 2.3.3 users.  This
  19. patch does not add new functionality or bug fixes.  It merely addresses
  20. a porting issue and cleans up the documentation a bit.  Please see
  21. the README file for additional details.
  22.  
  23. Index: patchlevel
  24. *** /dev/null    Fri Oct 23 19:50:30 1992
  25. --- patchlevel    Fri Oct 23 19:57:46 1992
  26. ***************
  27. *** 0 ****
  28. --- 1,9 ----
  29. + Patchlevel 1    Add CONS_GETINFO declarations for XENIX 2.3.3.  Cleanup
  30. +         descriptive text.  Update README with information on
  31. +         compatibility with various XENIX releases.
  32. + Patchlevel 0    Initial release.  (comp.sources.misc vol 30, issue 76)
  33. + @(#) patchlevel 1.2 92/10/23 19:57:37
  34. Index: README
  35. *** Distrib/README    Fri Oct 23 19:43:01 1992
  36. --- README    Fri Oct 23 19:44:01 1992
  37. ***************
  38. *** 1,16 ****
  39. ! @(#) README 1.3 92/06/16 21:17:03
  40.   
  41. ! `prtscrn' grabs the contents of a console MultiScreen(tm) on SCO
  42. ! UNIX and XENIX systems.
  43.   
  44. ! To dump the contents of /dev/tty01 to a file, you'd run:
  45.   
  46.       prtscrn -1 >filename
  47.   
  48. ! To dump the contents of the current screen, simply run:
  49.   
  50.       prtscrn >filename
  51.   
  52.   An earlier version of the `prtscrn' program was published in
  53.   comp.sources.misc volume 22.  This version has many improvements.
  54.   
  55. --- 1,22 ----
  56. ! @(#) README 1.5 92/10/23 19:42:43
  57.   
  58. ! `prtscrn' grabs the contents of a console MultiScreen(tm) on SCO Unix
  59. ! and Xenix systems.  This program has been tested on SCO Unix release
  60. ! 3.2v2.0 and SCO Xenix release 2.3.4.  This program will NOT work with
  61. ! SCO Xenix/286 or old releases of SCO Xenix -- see below for more info.
  62.   
  63. ! To dump the contents of /dev/tty01 to a file, you'd run
  64.   
  65.       prtscrn -1 >filename
  66.   
  67. ! To dump the contents of the current screen, simply run
  68.   
  69.       prtscrn >filename
  70.   
  71. + To print the current screen, say
  72. +     prtscrn | lp
  73.   An earlier version of the `prtscrn' program was published in
  74.   comp.sources.misc volume 22.  This version has many improvements.
  75.   
  76. ***************
  77. *** 18,24 ****
  78.         the kernel or system memory, and thus no longer needs to be
  79.         installed with privileges.
  80.   
  81. !     - This version is portable between SCO XENIX and SCO UNIX.  Not
  82.         only are there no longer special ifdef's, but also a binary
  83.         compiled on one of these will work on the other.
  84.   
  85. --- 24,30 ----
  86.         the kernel or system memory, and thus no longer needs to be
  87.         installed with privileges.
  88.   
  89. !     - This version is portable between SCO Xenix and SCO Unix.  Not
  90.         only are there no longer special ifdef's, but also a binary
  91.         compiled on one of these will work on the other.
  92.   
  93. ***************
  94. *** 33,38 ****
  95. --- 39,68 ----
  96.   
  97.       - I've coded this version to hopefully support systems with multiple
  98.         display adapters, but I haven't tested it.
  99. + NOTE TO SCO XENIX USERS:
  100. +     This utility uses a operation called CONS_GETINFO to obtain required
  101. +     information on the console.  As far as I know, no releases of SCO
  102. +     Xenix/286 support this function.  This operation is fully supported
  103. +     under Xenix/386 2.3.4, and is not supported at all under Xenix/386
  104. +     2.3.2 and earlier.  It is supported under *some* releases of 2.3.3.
  105. +     There were several different releases of SCO Xenix which called
  106. +     themselves 2.3.3.  The later ones include the required console
  107. +     driver updates.  If you are running 2.3.3 by way of update UFN
  108. +     (SLS xnx296) then this utility will work.  If you are running
  109. +     2.3.3 by way of update UFJ (included with older versions of VP/ix)
  110. +     then this utility will *not* run.  I do not know offhand whether
  111. +     2.3.3 by way of update UFM (SLS xnx155B) has the new console driver
  112. +     or not.
  113. +     If you are stuck with a version of Xenix which will not support
  114. +     this utility, there is an earlier version of `prtscrn' in the
  115. +     comp.sources.misc archives (volume 22, issue 27) you may use.
  116. +     That older release isn't as good as this one, but it is functional.
  117.   
  118.   Chip Rosenthal
  119.   <chip@chinacat.Unicom.COM>
  120. Index: prtscrn.c
  121. *** Distrib/prtscrn.c    Fri Oct 23 19:43:01 1992
  122. --- prtscrn.c    Fri Oct 23 19:43:50 1992
  123. ***************
  124. *** 1,38 ****
  125.   #ifndef lint
  126. ! static char SCCSID[] = "@(#) prtscrn.c 1.6 92/06/17 01:09:54";
  127.   #endif
  128.   
  129.   /*
  130.    * prtscrn - SCO UNIX/XENIX console screen dump utility.
  131.    *
  132. !  * This works by attaching to the display adapter memory and extracting
  133. !  * the out the characters and dumping them to stdout.  In order to
  134. !  * do this we need to make the selected screen active so that it's
  135. !  * contents are loaded into display memory.  What gets tricky is that
  136. !  * we need to figure out what screen is on the adapter when we begin
  137. !  * so we can put that screen back when we are done.
  138.    *
  139. !  * One way to find out what screen is active is to open up the
  140. !  * display adapter (e.g. "/dev/vga") and do a CONS_GETINFO ioctl()
  141. !  * upon it.  However, we first need to know what kind of display
  142. !  * adapter is being used.  If we are dumping a specific screen
  143. !  * (i.e. a screen number was given on the command line) then we
  144. !  * will open up that tty, and do a CONS_CURRENT ioctl() upon it
  145. !  * to get the adapter type.  If we are dumping the current screen
  146. !  * (i.e.  no screen number given on the command line) then we
  147. !  * will do the CONS_CURRENT ioctl() upon "/dev/tty".  Note that
  148. !  * a side effect of this is that we should be able to make a dump
  149. !  * of a screen from any terminal on the system (permissions
  150. !  * willing), and further this should work on a system with multiple
  151. !  * display adapters.
  152.    *
  153. -  * Security is enforced by permissions on the console tty.  That is,
  154. -  * if you try to dump screen 2, then you need to have read/write
  155. -  * permissions to /dev/tty02.  This utility assumes that the user
  156. -  * has read permissions on the adapter device, e.g. /dev/vga.  The
  157. -  * default is to grant world read/write for these devices.  I'm not
  158. -  * sure that is wise, but we assume that's the way things are.
  159. -  *
  160.    * Edit at tabstops=4.
  161.    *
  162.    * Chip Rosenthal
  163. --- 1,30 ----
  164.   #ifndef lint
  165. ! static char SCCSID[] = "@(#) prtscrn.c 1.8 92/10/23 19:42:44";
  166.   #endif
  167.   
  168.   /*
  169.    * prtscrn - SCO UNIX/XENIX console screen dump utility.
  170.    *
  171. !  * This utility works by attaching to the display adaptor memory,
  172. !  * extracting the characters from memory, and dumping them to
  173. !  * stdout.  This means that we need to activate the selected
  174. !  * screen so that its contents are loaded into display memory.
  175. !  * We also need to figure out which screen was active on the
  176. !  * display at startup so that we can put that screen back on the
  177. !  * display when done.
  178.    *
  179. !  * There are some gyrations we need to go through in order to
  180. !  * support various adapter types -- and even systems with multiple
  181. !  * display adapters.  First, we need to open the screen we want
  182. !  * to dump (e.g.  "/dev/tty02") and do a CONS_CURRENT ioctl()
  183. !  * upon it.  This will tell us the sort of adapter this screen
  184. !  * is upon.  Then we can open up the adapter device (e.g.
  185. !  * "/dev/vga") and manipulate the screen selection and access
  186. !  * the display memory.  This utility needs read/write access to
  187. !  * the screen device and read access to the display adapter.
  188. !  * This can be used to prevent unauthorized people from dumping
  189. !  * another person's display.
  190.    *
  191.    * Edit at tabstops=4.
  192.    *
  193.    * Chip Rosenthal
  194. ***************
  195. *** 53,58 ****
  196. --- 45,71 ----
  197.   #include <sys/vtkd.h>
  198.   
  199.   #define USAGE    "usage: %s [-screen_num]\n"
  200. + /*
  201. +  * Although the CONS_GETINFO operation was added in XENIX 2.3.3, the
  202. +  * header files were not updated until 2.3.4.  We need to provide the
  203. +  * required declarations for 2.3.3 systems.
  204. +  */
  205. + #ifndef CONS_GETINFO /*{*/
  206. + #    define CONS_GETINFO    (CONSIOC|73)
  207. +     struct vid_info
  208. +     {
  209. +         short    size;                /* must be first field            */
  210. +         short    m_num;                /* multiscreen number, 0 based    */
  211. +         ushort    mv_row, mv_col;        /* cursor position                */
  212. +         ushort    mv_rsz, mv_csz;        /* text screen size                */
  213. +         struct colors    mv_norm,    /* normal attributes            */
  214. +                 mv_rev,                /* reverse video attributes        */
  215. +                 mv_grfc;            /* graphic character attributes    */
  216. +         uchar_t mv_ovscan;            /* border color                    */
  217. +         uchar_t mk_keylock;            /* caps/num/scroll lock            */
  218. +     };
  219. + #endif /*}!CONS_GETINFO*/
  220.   
  221.   char *Progname;
  222.   
  223. Index: prtscrn.1
  224. *** Distrib/prtscrn.1    Fri Oct 23 19:43:01 1992
  225. --- prtscrn.1    Fri Oct 23 19:44:01 1992
  226. ***************
  227. *** 1,4 ****
  228. ! .\" @(#) prtscrn.1 1.5 92/06/16 21:17:04
  229.   .TH PRTSCRN 1L
  230.   .SH NAME
  231.   prtscrn \- Print contents of a console multiscreen.
  232. --- 1,4 ----
  233. ! .\" @(#) prtscrn.1 1.6 92/10/23 19:42:44
  234.   .TH PRTSCRN 1L
  235.   .SH NAME
  236.   prtscrn \- Print contents of a console multiscreen.
  237. ***************
  238. *** 20,25 ****
  239. --- 20,29 ----
  240.   Never tested with multiple display adapters.
  241.   Only supports text mode operation.
  242.   Although it will handle eight-bit characters, it won't do attributes.
  243. + .P
  244. + This utility is supported on SCO Unix, SCO Xenix 2.3.4, and SCO Xenix
  245. + 2.3.3 by way of update UFN (SLS xnx296).  It is not supported on
  246. + Xenix/286 or older releases of Xenix/386.
  247.   .SH AUTHOR
  248.   Chip Rosenthal
  249.   .br
  250.  
  251. <end of patch1 to prtscrn2>
  252.  
  253. -- 
  254. Chip Rosenthal  512-482-8260 | I got the blues so bad one time
  255. Unicom Systems Development   | it put my face in a permanent frown.
  256. <chip@chinacat.Unicom.COM>   |   - Taj Mahal
  257.  
  258.  
  259. exit 0 # Just in case...
  260.