home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 110_01 / tek.c < prev    next >
Text File  |  1984-03-03  |  896b  |  48 lines

  1. /* tek.c puts LINES lines on the screen then gets more while user */
  2. /* is reading the previous. */
  3.  
  4. #define LINES 36
  5. #include "BDSCIO.H"
  6. int c;
  7. char *s;
  8. char first;
  9. FILE in;
  10. char *buf;
  11. char lines;
  12.  
  13. main(argc,argv)
  14. int argc;
  15. char *argv[];
  16. {
  17.     int ac;
  18.     buf= sbrk(0);
  19.     first=1;
  20.     for (ac=1;ac < argc;ac++) {
  21.         if(fopen(argv[ac], in)==ERROR) {
  22.             printf("Can't open %s\n", argv[ac]);
  23.             continue;
  24.         }
  25. ragain:
  26.         s=buf;
  27.         lines=LINES;
  28.         while((c=getc(in)) != EOF && c != CPMEOF && c != 0)
  29.         {
  30.             *s++ =c;
  31.             if(c == '\n' && --lines == 0)
  32.                 break;
  33.         }
  34.         *s++ =0;
  35.         if( !first)
  36.             getchar();
  37.         first=0;
  38.         printf("\033\014");
  39.         sleep(20);
  40.         for( s=buf; *s; )
  41.             putchar(*s++);
  42.         if(c != CPMEOF && c != EOF)
  43.             goto ragain;
  44.         printf("<<<< EOF >>>>");
  45.     }
  46.     printf(".... END ....");
  47. }
  48.