
#include <stdio.h>
#include "hd.h"


char buf[ HD_SECTOR ];


main ()
{
	struct posn posn;
	int status;


	if ( wd_open () != 0 ) {
		printf ( "wd_open() failed\n" );
		exit ( 1 );
	}
	for ( posn.cylinder = 0; posn.cylinder < first.cylinders; posn.cylinder++ ) {
		printf ( "%03ld " , posn.cylinder );
		fflush ( stdout );
		for ( posn.surface = 0; posn.surface < first.heads; posn.surface++ ) {
			for ( posn.sector = 0; posn.sector < first.sectors; posn.sector++ ) {
				posn.block = posn.sector
					+ ( posn.surface * first.sectors )
					+ ( posn.cylinder * first.sectors * first.heads );
				if ( ( status = read_sector ( &posn , buf ) ) != 0 ) {
					printf ( "\nread error:  block %3ld  cylinder %3ld  surface %ld  sector %2ld  status %02x\n" ,
						posn.block , posn.cylinder , posn.surface ,
						posn.sector , status );
				}
			}
		}
	}
	wd_close ();
}
