/* CATOFS - cat a file showing beginning byte offset at/of beginning of every line. */
#include <stdio.h>

extern int exit();

int
main( argc, argv )
int argc;
char **argv;
{
FILE *fp;
char buf[3000];
long ofs;

if( argc != 2 ) { fprintf( stderr, "usage: catofs file\n" ); exit( 1 ); }

fp = fopen( argv[1], "r" );
if( fp == NULL ) { fprintf( stderr, "catofs error: cannot open file %s\n", argv[1] ); exit( 1 ); }

ofs = ftell( fp );
while( fgets( buf, 2999, fp ) != NULL ) {
	printf( "%8ld: %s", ofs, buf );
	ofs = ftell( fp );
	}
exit( 0 );
}
