home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / lib_term / gotoxy.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  1.1 KB  |  61 lines

  1.  
  2. void gotoxy(col, line)
  3. int col, line;
  4.  
  5. /*
  6.  ---------------------------------------------------------------------------
  7.  
  8.    Last revision - 
  9.      29 March 1984 - GWS
  10.  
  11.  
  12.    NAME
  13.      gotoxy - move the cursor to the requested position
  14.  
  15.    SYNOPSIS
  16.     void gotoxy(col, line) 
  17.     int col, line;
  18.  
  19.    DESCRIPTION
  20.     Uses termcap(3x) routines to move cursor.  The columns and
  21.     lines are numbered starting with 1.
  22.  
  23.    SEE ALSO
  24.     termcap(3) 
  25.  
  26.    DIAGNOSTICS
  27.     If the cursor doesn't move, it didn't work. 
  28.  
  29.    AUTHOR
  30.      George W. Sherouse
  31.      29 March 1984
  32.  
  33.  ---------------------------------------------------------------------------
  34. */
  35.  
  36. {
  37.     static called = 0;
  38.     static char id[] = "cm", cm_str[20];
  39.     static char *point = cm_str, **point2 = &point;
  40.     extern char bp[1024];
  41.     int tgetent();
  42.     int tputs();
  43.     int putchar();
  44.     char *tgoto();
  45.     char str[20];
  46.     int loop;
  47.  
  48.     if (!called)
  49.     {
  50.     tgetstr(id, point2);
  51.     called++;
  52.     }
  53.  
  54.     for (loop = 0; loop < 20; loop++)
  55.     str[loop] = cm_str[loop];
  56.  
  57.  
  58.     (void) tputs(tgoto(str, col - 1, line - 1), 1, putchar);
  59.     return;
  60. }
  61.