home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume8 / help.jn / listit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-19  |  454 b   |  33 lines

  1. #include <stdio.h>
  2. listit(fn)
  3. char *fn;
  4. {
  5.     int i;
  6.     char line[153];
  7.     FILE *fp;
  8.     fp=fopen(fn,"r");
  9.     if(fp==(FILE *)0)return(-1);
  10.     puts("");
  11.     i=0;
  12.     while(fgets(line,132,fp)==line)
  13.     {
  14.         i++;
  15.         if(  (i%21)==0 ){
  16.             int c;
  17.             printf("---more---");
  18.             fflush(stdout);
  19.             cbreak();
  20.             c=getchar();
  21.             nocbreak();
  22. /*            puts("");*/
  23.             printf("\r           \r");
  24.             if(c=='q')goto out;
  25.  
  26.         }
  27.         printf("%s",line);
  28.     }
  29. out:
  30.     if(fp)if(fclose(fp)<0)exit(1);
  31.     return 0;
  32. }
  33.