X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=libs%2Fshttpd%2Fcompat_win32.h;fp=libs%2Fshttpd%2Fcompat_win32.h;h=a5c1dce7149e8da9cceecce1a800b03500d63e49;hb=d8ccfe2b3944adf07d35534459cdda19d15217c8;hp=0000000000000000000000000000000000000000;hpb=21f835f30b4e092c847bf4569a00995774f7330e;p=fms.git diff --git a/libs/shttpd/compat_win32.h b/libs/shttpd/compat_win32.h new file mode 100644 index 0000000..a5c1dce --- /dev/null +++ b/libs/shttpd/compat_win32.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2004-2007 Sergey Lyubka + * All rights reserved + * + * "THE BEER-WARE LICENSE" (Revision 42): + * Sergey Lyubka wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. + */ + +/* Tip from Justin Maximilian, suppress errors from winsock2.h */ +#define _WINSOCKAPI_ + +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32_WCE + +#ifdef _MSC_VER /* pragmas not valid on MinGW */ +#pragma comment(lib,"ws2_32") +#pragma comment(lib,"user32") +#pragma comment(lib,"comctl32") +#pragma comment(lib,"comdlg32") +#pragma comment(lib,"shell32") +#ifdef NO_GUI +#pragma comment(linker,"/subsystem:console") +#else +#pragma comment(linker,"/subsystem:windows") +#endif /* NO_GUI */ +#endif /* _MSC_VER */ +#include +#include +#include + +#else /* _WIN32_WCE */ + +/* Windows CE-specific definitions */ +#define NO_CGI /* WinCE has no pipes */ +#define NO_GUI /* temporarily until it is fixed */ +#pragma comment(lib,"ws2") +/* WinCE has both Unicode and ANSI versions of GetProcAddress */ +#undef GetProcAddress +#define GetProcAddress GetProcAddressA +#include "compat_wince.h" + +#endif /* _WIN32_WCE */ + +#define ERRNO GetLastError() +#define NO_SOCKLEN_T +#define SSL_LIB L"libssl32.dll" +#define DIRSEP '\\' +#define IS_DIRSEP_CHAR(c) ((c) == '/' || (c) == '\\') +#define O_NONBLOCK 0 +#define EWOULDBLOCK WSAEWOULDBLOCK +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#define mkdir(x,y) _mkdir(x) +#define popen(x,y) _popen(x, y) +#define pclose(x) _pclose(x) +#define dlopen(x,y) LoadLibraryW(x) +#define dlsym(x,y) (void *) GetProcAddress(x,y) +#define _POSIX_ + +#ifdef __LCC__ +#include +#endif /* __LCC__ */ + +#ifdef _MSC_VER /* MinGW already has these */ +typedef unsigned int uint32_t; +typedef unsigned short uint16_t; +typedef __int64 uint64_t; +#define S_ISDIR(x) ((x) & _S_IFDIR) +#endif /* _MSC_VER */ + +/* + * POSIX dirent interface + */ +struct dirent { + char d_name[FILENAME_MAX]; +}; + +typedef struct DIR { + HANDLE handle; + WIN32_FIND_DATAW info; + struct dirent result; + char *name; +} DIR; + +extern DIR *opendir(const char *name); +extern int closedir(DIR *dir); +extern struct dirent *readdir(DIR *dir);