/* clist

   This program lists one or more C source files with
   line numbers, and page breaks at end of page and end
   of file.

   Copyright (c) 1980, by Cromemco, Inc., All Rights Reserved

*/

#control nlist
#include "stdio.h"
#control list

#control source

#define	CR	13
#define	EXPCHAR	 8	/* expanded-print character for dot-matrix */
#define	FF	12
#define	LF 	10
#define SP 	32


main( argc, argv )

unsigned argc;
char 	 *argv[];

   {
   static unsigned linenum,
       	       	   linecnt,
       	       	   fnum = 0;
   static char 	   lnbuf[ 258 ];
   static int  	   numchars,
       	       	   i,
       	       	   rdfile;


   while ( ++fnum < argc )
       {

       rdfile = fopen( argv[fnum], "R" );

       if  ( rdfile )
       	   {

       	   linenum = 0;
       	   linecnt = 56;
       	   
       	   while( getl( rdfile, lnbuf, 256 ) )
       	       {
 
      	       if ( ++linecnt > 56 )
       	       	   {
       	       	   putchar( FF );
       	       	   putchar( EXPCHAR );
       	       	   putchar( SP );
       	       	   fputs( argv[fnum], STDOUT );
       	       	   putchar( CR );
       	       	   putchar( LF );
       	       	   putchar( LF );
        	 	 	
       	       	   linecnt = 1;
       	       	   }
       	       
       	       printf( "%+ 5d\t", ++linenum );
       	       fputs( lnbuf, STDOUT );

       	       }  /* end the while.getl */

       	   fclose( rdfile );  /* only close if fopened */

       	   }  /* end the if.rdfile */

       }  /* end the while.fnum */

   putchar( FF );

   }  /* end of main */
