home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 110_01 / undel.c < prev    next >
Text File  |  1984-03-03  |  2KB  |  108 lines

  1.  
  2. #include <undelete.h>
  3.  
  4. init(disk)
  5. char disk;
  6. {
  7.     char ch;
  8.     int *ptr, *tbl;
  9.     ptr =  1;
  10.     badr = *ptr -3;
  11.     tbl = call(badr+(SELDSK*3),0,0,disk);
  12.     transtbl = *tbl;
  13. }
  14.  
  15. translate(sec)
  16. char sec;
  17. {
  18.     return call(badr+(SECTRAN*3),0,0,sec,transtbl);
  19. }
  20.  
  21.  
  22.  
  23.  
  24. dump(sec,trk,index)
  25. int sec, trk, index;
  26. {
  27.     int count, lines;
  28.     char *secx;
  29.     char c;
  30.     secx = sector[index].dir;
  31.     printf("\nTrack %d, Sector %d\n",trk,sec);
  32.  
  33.     for(lines=0;lines<8;lines++)
  34.     {
  35.         printf("\n%d\t",(lines*16));
  36.         for(count=0;count<16;count++)
  37.             printf("%2x ",secx[(lines<<4)+count]);
  38.         for(count=0;count<16;count++)
  39.         {
  40.             c = secx[(lines << 4)+count] & 0x7f;
  41.             if (c < 0x20) putchar('.');
  42.             else putchar(c);
  43.         }
  44.     }
  45.     putchar('\n');
  46. }
  47.  
  48. /* dump(sec,trk) */
  49.  
  50. fillarray(disk)
  51. int disk;
  52. {
  53.     int dircnt;
  54.     int track, logical;
  55.     init(disk);
  56.     for(dircnt=0;dircnt<DIRSIZ;dircnt++)
  57.     {
  58.         track = DTRACK+(dircnt/NSECS);
  59.         logical = dircnt % NSECS;
  60.         bios(SETTRK,track);
  61.  
  62.         bios(SETSEC,translate(logical));
  63.  
  64.         bios(SETDMA,sector[dircnt].dir);
  65.         bios(DREAD);
  66.         if(Dump) dump(translate(logical),track,dircnt);
  67.     }
  68. }
  69.  
  70. cmp(len,s1,s2)
  71. int len; char *s1, *s2;
  72. {
  73.     while(len--) if((*s1 != '?') && ((*s1++ & 0x7f) != 
  74.          (*s2++ & 0x7f))) return 0;
  75.     return 1;
  76. }
  77.  
  78.  
  79. findfcb(fd)    /* Given a pointer to an fcb return the nescessary indices */
  80. char *fd;
  81. {
  82.     int s, c;
  83.  
  84.     fcb = fd; /* Map into structure */
  85.     for(s=0;s<16;s++)
  86.         for(c=0;c<4;c++)
  87.             if(cmp(11,fcb->name,sector[s].dir[c].name) &&
  88.              (sector[s].dir[c].ext == fcb->ext))
  89.             {
  90.                 marker.entry = c;
  91.                 marker.sec = s;
  92.                 marker.ptr = sector[s].dir[c];
  93.                 return 1;
  94.             }
  95.  
  96.     return 0;   /* Directory entry not found */
  97. }
  98.  
  99. _mvx(s)
  100. char *s;
  101. {
  102.     char *p;
  103.     p = s+2;
  104.     while(*s++ = *p++);
  105. }
  106. rk) */
  107.  
  108. fillar