home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / croutes.zip / CURFOR.C < prev    next >
Text File  |  1984-04-05  |  1KB  |  47 lines

  1. /*                        *** curfor.c ***                           */
  2. /*                                                                   */
  3. /* IBM - PC microsoft "C"                                            */
  4. /*                                                                   */
  5. /* Function to move the cursor forward x relative columns.           */
  6. /*                                                                   */
  7. /* Written by L. Cuthbertson, March 1984.                            */
  8. /*                                                                   */
  9. /*********************************************************************/
  10. /*                                                                   */
  11.  
  12. #define NULL    '\000'
  13. #define POUND    '#'
  14.  
  15. curfor(x)
  16. int x;
  17. {
  18.     extern char CUF[];
  19.     char xrel[3],command[20];
  20.     int i,inpos,outpos;
  21.  
  22.     /* initialize screen controls */
  23.     scrinit();
  24.  
  25.     /* convert integer relative motion into string */
  26.     sprintf(xrel,"%d",x);
  27.  
  28.     /* build command line */
  29.     inpos = 0;    /* position within control string */
  30.     outpos = 0;    /* position within command string */
  31.  
  32.     while (CUF[inpos] != POUND)
  33.         command[outpos++] = CUF[inpos++];
  34.  
  35.     for (i=0;xrel[i] != NULL;i++)
  36.         command[outpos++] = xrel[i];
  37.  
  38.     inpos++;
  39.     while (CUF[inpos] != NULL)
  40.         command[outpos++] = CUF[inpos++];
  41.  
  42.     command[outpos] = NULL;
  43.  
  44.     /* write command to screen */
  45.     writes(command);
  46. }
  47.