2
* $Id: getfree.c,v 2.2 2001/04/25 20:07:36 gul Exp $
6
* Revision 2.2 2001/04/25 20:07:36 gul
9
* Revision 2.1 2001/04/23 07:58:57 gul
10
* getfree() on large drives fixed
12
* Revision 2.0 2001/01/10 12:12:40 gul
13
* Binkd is under CVS again
27
extern void Log (int lev, char *s,...);
29
unsigned long getfree (char *path)
35
if (isalpha (path[0]) && path[1] == ':')
36
disknum = toupper (path[0]) - 'A' + 1;
38
rc = DosQueryFSInfo (disknum, /* Drive number */
39
FSIL_ALLOC, /* Level 1 allocation info */
40
(PVOID) & fsa, /* Buffer */
41
sizeof (fsa)); /* Size of buffer */
45
Log (1, "DosQueryFSInfo error: return code = %u", rc);
46
return ULONG_MAX; /* Assume enough disk space */
50
if (fsa.cSectorUnit * fsa.cbSector >= 1024)
51
return fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector / 1024);
53
return fsa.cUnitAvail / (1024 / (fsa.cSectorUnit * fsa.cbSector));