|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 853 (0x355) Types: TextFile Notes: UNIX file Names: »bang.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦2d53db1df⟧ UNIX Filesystem └─⟦this⟧ »frankh/lib/bang.c«
/* * C900 disk exerciser. July 3, 1985 */ #include <flib.h> bang( dev, sblk, eblk, count) char *dev; unsigned long sblk,eblk; int count; { register int i, fdi, fdo, err; register long blk; /* printf("btst: bang: %s %U %U %u \n", dev, sblk, eblk, count); */ err = 0; if ((fdi = open(dev, 0)) < 0) panic("can't open input device\n"); if ((fdo = open(dev, 1)) < 0) panic("can't open output device\n"); printf("btst: testing:\t%s\n", dev); for (i = 0; i < count; ++i) { blk = xrand(sblk, eblk); /* generate random block number */ bwrite(fdo, blk, pattern); /* write the block with pattern */ clr( buf); /* clear buffer */ bread(fdi, blk, buf); /* read it back */ if (check(buf, sblk)) /* see if ok */ ++err; } printf("btst: device:\t%s\terrors this pass:\t%u\n", dev, err); close(fdi); close(fdo); return(err); }