home *** CD-ROM | disk | FTP | other *** search
- /* sys/filesys.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
-
- #include <sys/emx.h>
- #include <string.h>
- #include <errno.h>
- #include <os2emx.h>
- #include "syscalls.h"
-
- #define QFSA_SIZE 256
-
- int __filesys (const char *drive, char *name, size_t size)
- {
- ULONG rc;
- ULONG len;
- FSQBUFFER2 *buf;
-
- len = sizeof (FSQBUFFER2) + QFSA_SIZE;
- buf = alloca (len);
- rc = DosQueryFSAttach (drive, 1, FSAIL_QUERYNAME, buf, &len);
- if (rc != 0)
- {
- _sys_set_errno (rc);
- return (-1);
- }
- if (buf->iType != FSAT_LOCALDRV && buf->iType != FSAT_REMOTEDRV)
- {
- errno = EINVAL;
- return (-1);
- }
- if (buf->cbFSDName >= size)
- {
- errno = E2BIG;
- return (-1);
- }
- strcpy (name, buf->szFSDName + buf->cbName);
- return (0);
- }
-