# 2.11BSD#431 - /usr/src/local/mtools/fat_free.c

##### Functions

    fat_free          X

       1: #include <stdio.h>
       2: #include "msdos.h"
       3:
       4: extern int fat_error;
       5: extern unsigned int last_fat;
       6:
       7: /*
       8:  * Remove a string of FAT entries (delete the file).  The argument is
       9:  * the beginning of the string.  Does not consider the file length, so
      10:  * if FAT is corrupted, watch out!
      11:  */
      12:
      13: int
      14: fat_free(fat)
      15: unsigned int fat;
      16: {
      17:     unsigned int next, fat_decode();
      18:                     /* a zero length file? */
      19:     if (fat == 0)
      20:         return(0);
      21:
      22:     /* CONSTCOND */
      23:     while (1) {
      24:                     /* get next cluster number */
      25:         next = fat_decode(fat);
      26:                     /* mark current cluster as empty */
      27:         if (fat_encode(fat, 0) || next == 1) {
      28:             fprintf(stderr, "fat_free: FAT problem\n");
      29:             fat_error++;
      30:             return(-1);
      31:         }
      32:         if (next >= last_fat)
      33:             break;
      34:         fat = next;
      35:     }
      36:     return(0);
      37: }

#### Defined functions

fat_free defined in line 13; used 6 times

- in /usr/src/local/mtools/file_write.c line 35, 53
- in /usr/src/local/mtools/mdel.c line 110
- in /usr/src/local/mtools/mrd.c line 100
- in /usr/src/local/mtools/mwrite.c line 167, 184

Last modified: 1992-06-24 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 424 |