Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1exp 11/4/83; site ihuxl.UUCP Path: utzoo!linus!decvax!harpo!floyd!clyde!ihnp4!ihuxl!dcn From: dcn@ihuxl.UUCP (Dave Newkirk) Newsgroups: net.sources Subject: Aztec C source - more.c Message-ID: <737@ihuxl.UUCP> Date: Mon, 14-Nov-83 09:27:14 EST Article-I.D.: ihuxl.737 Posted: Mon Nov 14 09:27:14 1983 Date-Received: Tue, 15-Nov-83 06:30:03 EST Organization: AT&T Bell Labs, Naperville, Il Lines: 57 /* more - print file a page at a time */ #include "stdio.h" #define PAGESIZE 24 int lines ; main(argc, argv) int argc ; char *argv[] ; { FILE *input ; argc-- ; argv++ ; lines = 0 ; for( ; argc > 0 ; argc--, argv++ ) if( (input=fopen(*argv,"r")) == NULL ) { fprintf(stderr, "more: can't open %s\n", *argv) ; exit(1) ; } else { more( input ) ; fclose( input ) ; } exit(0) ; } /* end main */ /* more - print file page at time */ more( in ) FILE *in ; { int c ; while( (c=agetc(in)) != EOF ) { aputc(c, stdout) ; if( c == NL ) lines++ ; if( lines >= PAGESIZE ) { lines = 1 ; printf("MORE") ; c = agetc(stdin) ; ioctl(1, 18, 0) ; if( c == 'q' ) exit(0) ; } } } /* end more */