1: #include "hd.h"
   2: #include <signal.h>
   3: 
   4: static int nointer;
   5: 
   6: page (stream) FILE *stream; {
   7: 
   8: int line, linelim;  register ch;
   9: register ttych, ttych1;
  10: 
  11: int (*oldsig)(); extern catch();
  12: 
  13: #define window  23
  14: #define scroll  10
  15: 
  16: linelim = window;  ch = 1;
  17: tty_push (COOKEDMODE);
  18: oldsig = signal (SIGINT, catch);  nointer = 1;
  19: 
  20: bufout ();  erase ();
  21: do {
  22:     for (line = 0; line < linelim; line++) {
  23:         while ((ch = getc (stream)) != EOF && ch != '\n')
  24:             putchar (ch);
  25:         if (ch == EOF) break;
  26:         putch ('\n');  fflush (stdout);
  27:     }
  28:     if (!nointer) break;
  29:     printf ((ch == EOF) ? "Done:  " : "More:  ");
  30:     fflush (stdout);
  31: 
  32:     ttych = ttych1 = getch ();
  33:     while (ttych != EOF && ttych != '\n') ttych = getch ();
  34:     if (ttych == EOF) {
  35:         linelim = scroll;
  36:         printf ("\r          \r");
  37:         fflush (stdout);
  38:     } else {
  39:         linelim = window;
  40:         erase ();
  41:     }
  42: 
  43: } while (ch != EOF && ttych1 != 'n' && nointer);
  44: unbufout ();  tty_pop ();  signal (SIGINT, oldsig);
  45: }
  46: 
  47: catch () {      /* Catch an interrupt */
  48:     nointer = 0;
  49:     signal (SIGINT, catch);
  50: }

Defined functions

catch defined in line 47; used 3 times
page defined in line 6; used 2 times

Defined variables

nointer defined in line 4; used 4 times

Defined macros

scroll defined in line 14; used 1 times
  • in line 35
window defined in line 13; used 2 times
Last modified: 1980-08-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 759
Valid CSS Valid XHTML 1.0 Strict