0.0.002
ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
This commit is contained in:
1 parent
f0f91540be
commit
b735900f2e
323 files changed
+134347
-343
No files matched your search
@@ -0,0 +1,80 @@
|
||||
#ifndef DATGPT_WIN_COMPAT_H
|
||||
#define DATGPT_WIN_COMPAT_H
|
||||
|
||||
/* Small POSIX spellings used by the shared C sources on native Windows. */
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <process.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#ifndef mkdir
|
||||
#define mkdir(path, mode) _mkdir(path)
|
||||
#endif
|
||||
#ifndef fsync
|
||||
#define fsync(fd) _commit(fd)
|
||||
#endif
|
||||
#ifndef getpid
|
||||
#define getpid _getpid
|
||||
#endif
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
#ifndef O_NOFOLLOW
|
||||
#define O_NOFOLLOW 0
|
||||
#endif
|
||||
#ifndef EKEYREJECTED
|
||||
#define EKEYREJECTED EACCES
|
||||
#endif
|
||||
#ifndef S_ISLNK
|
||||
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#ifndef S_IFLNK
|
||||
#define S_IFLNK 0120000
|
||||
#endif
|
||||
#ifndef fchmod
|
||||
#define fchmod(fd, mode) ((void)(fd), (void)(mode), 0)
|
||||
#endif
|
||||
#ifndef strcasecmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
#ifndef strncasecmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
static inline char *dat_win_getenv_compat(const char *name)
|
||||
{
|
||||
char *value = getenv(name);
|
||||
if (!value && name && !strcmp(name, "HOME")) value = getenv("USERPROFILE");
|
||||
return value;
|
||||
}
|
||||
#define getenv dat_win_getenv_compat
|
||||
static inline int dat_win_lstat(const char *path, struct stat *info)
|
||||
{
|
||||
DWORD attributes;
|
||||
if (stat(path, info)) return -1;
|
||||
attributes = GetFileAttributesA(path);
|
||||
if (attributes != INVALID_FILE_ATTRIBUTES && (attributes & FILE_ATTRIBUTE_REPARSE_POINT))
|
||||
info->st_mode = (info->st_mode & ~S_IFMT) | S_IFLNK;
|
||||
return 0;
|
||||
}
|
||||
#ifndef lstat
|
||||
#define lstat dat_win_lstat
|
||||
#endif
|
||||
static inline int dat_win_readlink(const char *path, char *target, size_t capacity)
|
||||
{ (void)path; (void)target; (void)capacity; errno = ENOTSUP; return -1; }
|
||||
static inline int dat_win_symlink(const char *target, const char *path)
|
||||
{ (void)target; (void)path; errno = ENOTSUP; return -1; }
|
||||
#ifndef readlink
|
||||
#define readlink dat_win_readlink
|
||||
#endif
|
||||
#ifndef symlink
|
||||
#define symlink dat_win_symlink
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user