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

  1. /*                        *** escreen.c ***                           */
  2. /*                                                                   */
  3. /* IBM - PC microsoft "C"                                            */
  4. /*                                                                   */
  5. /* Function to erase a line of the screen.                           */
  6. /*                                                                   */
  7. /*  0 = Erase form cursor to end of screen.                          */
  8. /*  1 = Erase from start of screen to cursor.                        */
  9. /*  2 = Erase entire screen.                                         */
  10. /*                                                                   */
  11. /* Written by L. Cuthbertson, March 1984.                            */
  12. /*                                                                   */
  13. /*********************************************************************/
  14. /*                                                                   */
  15.  
  16. #define NULL    '\000'
  17. #define POUND    '#'
  18.  
  19. escreen(y)
  20. int y;
  21. {
  22.     extern char ED[];
  23.     char yrel[2],command[20];
  24.     int i,inpos,outpos;
  25.  
  26.     /* initialize screen controls */
  27.     scrinit();
  28.  
  29.     /* error check */
  30.     if (y < 0 || y > 2)
  31.         y = 2;
  32.  
  33.     /* convert integer relative motion into string */
  34.     sprintf(yrel,"%d",y);
  35.  
  36.     /* build command line */
  37.     inpos = 0;    /* position within control string */
  38.     outpos = 0;    /* position within command string */
  39.  
  40.     while (ED[inpos] != POUND)
  41.         command[outpos++] = ED[inpos++];
  42.  
  43.     for (i=0;yrel[i] != NULL;i++)
  44.         command[outpos++] = yrel[i];
  45.  
  46.     inpos++;
  47.     while (ED[inpos] != NULL)
  48.         command[outpos++] = ED[inpos++];
  49.  
  50.     command[outpos] = NULL;
  51.  
  52.     /* write command to screen */
  53.     writes(command);
  54. }
  55.