MCPcopy Create free account
hub / github.com/NetHack/NetHack / freediskspace

Function freediskspace

outdated/sys/os2/os2.c:189–218  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

187}
188
189long
190freediskspace(path)
191char *path;
192{
193 FSALLOCATE FSInfoBuf;
194#ifdef OS2_32BITAPI
195 ULONG
196#else
197 USHORT
198#endif
199 DriveNumber, FSInfoLevel = 1, res;
200
201 if (path[0] && path[1] == ':')
202 DriveNumber = (toupper(path[0]) - 'A') + 1;
203 else
204 DriveNumber = 0;
205 res =
206#ifdef OS2_32BITAPI
207 DosQueryFSInfo(DriveNumber, FSInfoLevel, (PVOID) &FSInfoBuf,
208 (ULONG) sizeof(FSInfoBuf));
209#else
210 DosQFSInfo(DriveNumber, FSInfoLevel, (PBYTE) &FSInfoBuf,
211 (USHORT) sizeof(FSInfoBuf));
212#endif
213 if (res)
214 return -1L; /* error */
215 else
216 return ((long) FSInfoBuf.cSectorUnit * FSInfoBuf.cUnitAvail
217 * FSInfoBuf.cbSector);
218}
219
220/*
221 * Functions to get filenames using wildcards

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected