source: trunk/third-party/shttpd/compat_win32.h @ 6644

Last change on this file since 6644 was 6644, checked in by charles, 13 years ago

upgrade to shttpd 1.42

File size: 2.0 KB
Line 
1/*
2 * Copyright (c) 2004-2007 Sergey Lyubka <valenok@gmail.com>
3 * All rights reserved
4 *
5 * "THE BEER-WARE LICENSE" (Revision 42):
6 * Sergey Lyubka wrote this file.  As long as you retain this notice you
7 * can do whatever you want with this stuff. If we meet some day, and you think
8 * this stuff is worth it, you can buy me a beer in return.
9 */
10
11/* Tip from Justin Maximilian, suppress errors from winsock2.h */
12#define _WINSOCKAPI_
13
14#include <windows.h>
15#include <winsock2.h>
16#include <commctrl.h>
17#include <winnls.h>
18#include <shlobj.h>
19#include <shellapi.h>
20
21#ifndef _WIN32_WCE
22
23#include <process.h>
24#include <direct.h>
25#include <io.h>
26
27#else /* _WIN32_WCE */
28
29/* Windows CE-specific definitions */
30#define NO_CGI  /* WinCE has no pipes */
31#define NO_GUI  /* temporarily until it is fixed */
32#pragma comment(lib,"ws2")
33/* WinCE has both Unicode and ANSI versions of GetProcAddress */
34#undef GetProcAddress
35#define GetProcAddress GetProcAddressA
36#include "compat_wince.h"
37
38#endif /* _WIN32_WCE */
39
40#define ERRNO                   GetLastError()
41#define NO_SOCKLEN_T
42#define SSL_LIB                 L"ssleay32.dll"
43#define DIRSEP                  '\\'
44#define IS_DIRSEP_CHAR(c)       ((c) == '/' || (c) == '\\')
45#define O_NONBLOCK              0
46#define EWOULDBLOCK             WSAEWOULDBLOCK
47#define snprintf                _snprintf
48#define vsnprintf               _vsnprintf
49#define mkdir(x,y)              _mkdir(x)
50#define popen(x,y)              _popen(x, y)
51#define pclose(x)               _pclose(x)
52#define dlopen(x,y)             LoadLibraryW(x)
53#define dlsym(x,y)              (void *) GetProcAddress(x,y)
54#define _POSIX_
55
56#ifdef __LCC__
57#include <stdint.h>
58#endif /* __LCC__ */
59
60#ifdef _MSC_VER /* MinGW already has these */
61typedef unsigned int            uint32_t;
62typedef unsigned short          uint16_t;
63typedef __int64                 uint64_t;
64#define S_ISDIR(x)              ((x) & _S_IFDIR)
65#endif /* _MSC_VER */
66
67/*
68 * POSIX dirent interface
69 */
70struct dirent {
71        char    d_name[FILENAME_MAX];
72};
73
74typedef struct DIR {
75        HANDLE                  handle;
76        WIN32_FIND_DATAW        info;
77        struct dirent           result;
78        char                    *name;
79} DIR;
80
81extern DIR *opendir(const char *name);
82extern int closedir(DIR *dir);
83extern struct dirent *readdir(DIR *dir);
Note: See TracBrowser for help on using the repository browser.