home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
c
/
jazlib.arc
/
BADSECT.DMO
< prev
next >
Wrap
Text File
|
1986-07-20
|
1KB
|
43 lines
/*
┌────────────────────────────────────────────────────────────────────────────┐
│badsect.dmo │
│Display bad sectors on a given disk. │
│ │
│ (C) JazSoft Software by Jack A. Zucker (301) 794-5950 │
└────────────────────────────────────────────────────────────────────────────┘
*/
#include <jaz.h>
main()
{
badsect(0);
}
badsect(fdisk)
int fdisk;
{
#define BLKSIZE 32
TDISKBLK wdisk;
unsigned int wpartitions,wleftover;
register w,w2;
int werr;
char *wbuf,*malloc();
diskinfo(fdisk,&wdisk);
wbuf = malloc(wdisk.bytes * BLKSIZE); /* 32 sector blocks */
wpartitions = wdisk.ttlsect / BLKSIZE; /* find total 32 sector partitions */
wleftover = wdisk.ttlsect % BLKSIZE; /* find remaining sectors */
for (w = 0 ; w < wpartitions ; w ++ ) /* search through partition */
if (dosreads(fdisk,w*BLKSIZE,BLKSIZE,wbuf)) /* if error in partition */
for (w2 = 0 ; w2 < BLKSIZE ; w2 ++) /* search by sector */
if (dosreads(fdisk,w2+w*BLKSIZE,1,wbuf))
printf("%0004X ",w2+w*BLKSIZE);
if (dosreads(fdisk,wpartitions*BLKSIZE,wleftover,wbuf)) /* search leftovers */
printf("%0004X ",w*BLKSIZE);
}