Files
86Box/src/include/86box/plat_dir.h

75 lines
2.0 KiB
C
Raw Normal View History

2017-05-18 14:03:43 -04:00
/*
2023-01-06 15:36:05 -05:00
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
2017-05-18 14:03:43 -04:00
*
2023-01-06 15:36:05 -05:00
* This file is part of the 86Box distribution.
2017-05-18 14:03:43 -04:00
*
2023-01-06 15:36:05 -05:00
* Definitions for the platform OpenDir module.
2017-05-18 14:03:43 -04:00
*
2020-03-25 00:46:02 +02:00
*
2017-05-18 14:03:43 -04:00
*
2023-01-06 15:36:05 -05:00
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2017 Fred N. van Kempen.
2017-05-18 14:03:43 -04:00
*/
2022-02-18 19:42:21 -05:00
2017-05-18 14:03:43 -04:00
#ifndef PLAT_DIR_H
2022-09-18 17:15:38 -04:00
#define PLAT_DIR_H
2017-05-18 14:03:43 -04:00
/* Windows and Termux needs the POSIX re-implementations */
#if defined(_WIN32) || defined(__TERMUX__)
2022-11-19 08:49:04 -05:00
# ifdef _MAX_FNAME
# define MAXNAMLEN _MAX_FNAME
# else
# define MAXNAMLEN 15
# endif
# define MAXDIRLEN 127
2017-05-18 14:03:43 -04:00
struct dirent {
2022-09-18 17:15:38 -04:00
long d_ino;
unsigned short d_reclen;
unsigned short d_off;
2022-11-19 08:49:04 -05:00
# ifdef UNICODE
2022-09-18 17:15:38 -04:00
wchar_t d_name[MAXNAMLEN + 1];
2022-11-19 08:49:04 -05:00
# else
2022-09-18 17:15:38 -04:00
char d_name[MAXNAMLEN + 1];
2022-11-19 08:49:04 -05:00
# endif
2017-05-18 14:03:43 -04:00
};
2022-11-19 08:49:04 -05:00
# define d_namlen d_reclen
2017-05-18 14:03:43 -04:00
typedef struct {
2022-09-18 17:15:38 -04:00
short flags; /* internal flags */
short offset; /* offset of entry into dir */
long handle; /* open handle to Win32 system */
short sts; /* last known status code */
char *dta; /* internal work data */
2022-11-19 08:49:04 -05:00
# ifdef UNICODE
2022-09-18 17:15:38 -04:00
wchar_t dir[MAXDIRLEN + 1]; /* open dir */
2022-11-19 08:49:04 -05:00
# else
2022-09-18 17:15:38 -04:00
char dir[MAXDIRLEN + 1]; /* open dir */
2022-11-19 08:49:04 -05:00
# endif
2022-09-18 17:15:38 -04:00
struct dirent dent; /* actual directory entry */
2017-05-18 14:03:43 -04:00
} DIR;
/* Directory routine flags. */
2022-11-19 08:49:04 -05:00
# define DIR_F_LOWER 0x0001 /* force to lowercase */
# define DIR_F_SANE 0x0002 /* force this to sane path */
# define DIR_F_ISROOT 0x0010 /* this is the root directory */
2017-05-18 14:03:43 -04:00
/* Function prototypes. */
2022-09-18 17:15:38 -04:00
extern DIR *opendir(const char *);
extern struct dirent *readdir(DIR *);
extern long telldir(DIR *);
extern void seekdir(DIR *, long);
extern int closedir(DIR *);
2017-05-18 14:03:43 -04:00
2022-11-19 08:49:04 -05:00
# define rewinddir(dirp) seekdir(dirp, 0L)
#else
/* On linux and macOS, use the standard functions and types */
2022-11-19 08:49:04 -05:00
# include <sys/dir.h>
#endif
2022-09-18 17:15:38 -04:00
#endif /*PLAT_DIR_H*/