home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 21 / CD_ASCQ_21_040595.iso / dos / prg / c / freedos3 / source / jh_utils / pagef.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-07  |  592 b   |  34 lines

  1. #include <stdio.h>
  2. #include "freedos.h"
  3.  
  4. /************************************************************************
  5.  * This function paginates a file, displaying only a page at a time.
  6.  * maintainer: James Hall
  7.  */
  8.  
  9. unsigned long 
  10. pagef (FILE * p, int iLines)
  11. {
  12.   unsigned long ul;
  13.   char sz[MAX_STR];
  14.  
  15.   /* Read from the input stream and paginate the output. */
  16.  
  17.   for (ul = 0; fgets (sz, MAX_STR, p) != (char *) NULL; ul++)
  18.     {
  19.       if (ul == iLines)
  20.     {
  21.       ul = 0;
  22.       puts (PAGEF_PR);
  23.       bioskey ();
  24.     }
  25.  
  26.       printf ("%s", sz);
  27.     }
  28.  
  29.   puts (PAGEF_END);
  30.   bioskey ();
  31.  
  32.   return (ul);
  33. }
  34.