Mini-Unix/usr/sys/source/kdmp.c

Compare this file to the similar file:
Show the results in this format:

#define NBLKS	20

int	buf[256*NBLKS];

main(argc,argv)
char *argv[];
{
	int nread, nblks;
	char *kdump, *kore;
	int kfc, cfc;

	kdump = "/dev/rk0";
	kore = "kore";
	if((kfc = open(kdump,0)) < 0) {
		printf("can't read %s\n", kdump);
		exit();
	}
	if((cfc = creat(kore, 0666)) < 0) {
		printf("can't create %s\n", kore);
		exit();
	}
	seek(kfc, 4760, 3);
	nblks = 112;
	while(nblks > 0) {
		nread = NBLKS;
		if(nread > nblks)
			nread = nblks;
		nblks =- nread;
		nread = read(kfc, buf, nread*512);
		write(cfc, buf, nread);
	}
}