home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / SH164X.ZIP / ISFAT.C < prev    next >
C/C++ Source or Header  |  1990-11-15  |  1KB  |  63 lines

  1. /* ISFAT.C
  2.  *
  3.  * Autor:    Kai Uwe Rommel
  4.  * Datum:    Sun 28-Oct-1990
  5.  *
  6.  * Compiler: MS C ab 6.00
  7.  * System:   OS/2 ab 1.2
  8.  */
  9.  
  10. #define LABEL    "isfat.c"
  11. #define VERSION  "1.0"
  12.  
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #include <ctype.h>
  18.  
  19. #define INCL_NOPM
  20. #include <os2.h>
  21.  
  22.  
  23. int IsFileSystemFAT(char *dir)
  24. {
  25.   USHORT nDrive;
  26.   ULONG lMap;
  27.   BYTE bData[64], bName[3];
  28.   USHORT cbData;
  29.  
  30.   if ( _osmode == DOS_MODE )
  31.     return TRUE;
  32.   else
  33.   {
  34.     /* We separate FAT and HPFS file systems here.
  35.      * Filenames read from a FAT system are converted to lower case
  36.      * while the case of filenames read from a HPFS (and other future
  37.      * file systems, like Unix-compatibles) is preserved.
  38.      */
  39.  
  40.     if ( isalpha(dir[0]) && (dir[1] == ':') )
  41.       nDrive = toupper(dir[0]) - '@';
  42.     else
  43.       DosQCurDisk(&nDrive, &lMap);
  44.  
  45.     bName[0] = (char) (nDrive + '@');
  46.     bName[1] = ':';
  47.     bName[2] = 0;
  48.  
  49.     cbData = sizeof(bData);
  50.  
  51.     if ( !DosQFSAttach(bName, 0U, 1U, bData, &cbData, 0L) )
  52.       return !strcmp(bData + (*(USHORT *) (bData + 2) + 7), "FAT");
  53.     else
  54.       return FALSE;
  55.  
  56.     /* End of this ugly code */
  57.   }
  58. }
  59.  
  60.  
  61.  
  62. /* Ende ISFAT.C */
  63.