home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / C / CURSOR / CURSOR.C next >
Text File  |  1993-12-01  |  940b  |  29 lines

  1. /* CURSOR
  2.  *
  3.  * If there are no command line arguments the cursor state will be toggled.
  4.  * Any argument EXCEPT "off" will turn the cursor on.
  5.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  6.  
  7.  
  8. #include <dos.h>
  9.  
  10. union REGS in, out;
  11.  
  12. main(int argc, char *argv[])
  13. {
  14.   if(argc < 2) {                             /* No args = start toggle */
  15.     in.h.ah = 3;                             /* Get cursor scan lines  */
  16.     in.h.bh = 0;
  17.     int86(0x10, &in, &out);
  18.     if(out.x.cx == 0x2000) in.x.cx = 0x0708;          /* Toggle cursor */
  19.     else in.x.cx = 0x2000;
  20.   }
  21.  
  22.   else if(!strcmp(argv[1], "off"))     /* Was 'off' entered?  */
  23.      in.x.cx = 0x2000;             /* Yes, kill cursor    */
  24.   else   in.x.cx = 0x0708;             /* No,  turn cursor on */
  25.  
  26.   in.h.ah = 1;             /* function 1                      */
  27.   int86(0x10, &in, &out);  /* int 10 -- Set cursor scan lines */
  28. }
  29.