* @brief PlibC header
* @attention This file is usually not installed under Unix,
* so ship it with your application
- * @version $Revision: 69 $
+ * @version $Revision$
*/
#ifndef _PLIBC_H_
#include "langinfo.h"
#endif
-#include <windows.h>
#include <ws2tcpip.h>
+#include <windows.h>
#include <sys/types.h>
#include <time.h>
#include <stdio.h>
/* Convert LARGE_INTEGER to double */
#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
(double)((x).LowPart))
-
+#ifndef __MINGW64__
struct stat64
{
_dev_t st_dev;
__time64_t st_mtime;
__time64_t st_ctime;
};
-
+#endif
typedef unsigned int sa_family_t;
struct sockaddr_un {
#define MAP_SHARED 0x1
#define MAP_PRIVATE 0x2 /* unsupported */
#define MAP_FIXED 0x10
+#define MAP_ANONYMOUS 0x20 /* unsupported */
#define MAP_FAILED ((void *)-1)
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+
struct statfs
{
long f_type; /* type of filesystem (see below) */
BOOL _plibc_DereferenceShortcut(char *pszShortcut);
char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags);
char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags);
-long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey,
+
+long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey,
char *pszBuffer, long *pdLength);
+long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *pszSubKey,
+ wchar_t *pszBuffer, long *pdLength);
BOOL __win_IsHandleMarkedAsBlocking(int hHandle);
void __win_SetHandleBlockingMode(int s, BOOL bBlocking);
void __win_DiscardHandleBlockingMode(int s);
int _win_isSocketValid(int s);
int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
+int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows);
+
+int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows);
+int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows, int derefLinks);
+
unsigned plibc_get_handle_count();
typedef void (*TPanicProc) (int, char *);
int mkstemp(char *tmplate);
char *strptime (const char *buf, const char *format, struct tm *tm);
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
+struct tm *gmtime_r(const time_t *clock, struct tm *result);
int plibc_init(char *pszOrg, char *pszApp);
void plibc_shutdown();
int plibc_initialized();
-int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks);
+
void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine);
void SetErrnoFromWinsockError(long lWinError);
void SetHErrnoFromWinError(long lWinError);
void SetErrnoFromHRESULT(HRESULT hRes);
int GetErrnoFromWinsockError(long lWinError);
FILE *_win_fopen(const char *filename, const char *mode);
+int _win_fclose(FILE *);
DIR *_win_opendir(const char *dirname);
+struct dirent *_win_readdir(DIR *dirp);
+int _win_closedir(DIR *dirp);
int _win_open(const char *filename, int oflag, ...);
#ifdef ENABLE_NLS
char *_win_bindtextdomain(const char *domainname, const char *dirname);
int _win_symlink(const char *path1, const char *path2);
void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
unsigned long long offset);
+int _win_msync(void *start, size_t length, int flags);
int _win_munmap(void *start, size_t length);
int _win_lstat(const char *path, struct stat *buf);
int _win_lstat64(const char *path, struct stat64 *buf);
int _win_readlink(const char *path, char *buf, size_t bufsize);
int _win_accept(int s, struct sockaddr *addr, int *addrlen);
+
int _win_printf(const char *format,...);
+int _win_wprintf(const wchar_t *format, ...);
+
int _win_fprintf(FILE *f,const char *format,...);
+int _win_fwprintf(FILE *f,const wchar_t *format, ...);
+
int _win_vprintf(const char *format, va_list ap);
+int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr);
+
int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vwprintf(const wchar_t *format, va_list ap);
+
int _win_vsprintf(char *dest,const char *format, va_list arg_ptr);
+int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr);
+
int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr);
+int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list arg_ptr);
+
int _win_snprintf(char *str,size_t size,const char *format,...);
+int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...);
+
int _win_sprintf(char *dest,const char *format,...);
+int _win_swprintf(wchar_t *dest, const wchar_t *format, ...);
+
int _win_vsscanf(const char* str, const char* format, va_list arg_ptr);
+int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr);
+
int _win_sscanf(const char *str, const char *format, ...);
+int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...);
+
int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr);
+
int _win_vscanf(const char *format, va_list arg_ptr);
+int _win_vwscanf(const wchar_t *format, va_list arg_ptr);
+
int _win_scanf(const char *format, ...);
+int _win_wscanf(const wchar_t *format, ...);
+
int _win_fscanf(FILE *stream, const char *format, ...);
+int _win_fwscanf(FILE *stream, const wchar_t *format, ...);
+
+
pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
int _win_bind(int s, const struct sockaddr *name, int namelen);
int _win_connect(int s,const struct sockaddr *name, int namelen);
#endif
char *stpcpy(char *dest, const char *src);
char *strcasestr(const char *haystack_start, const char *needle_start);
-
+#ifndef __MINGW64__
#define strcasecmp(a, b) stricmp(a, b)
+#define wcscasecmp(a, b) wcsicmp(a, b)
#define strncasecmp(a, b, c) strnicmp(a, b, c)
-
+#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
+#endif
#endif /* WINDOWS */
#ifndef WINDOWS
#define CTIME_R(c, b) ctime_r(c, b)
#undef FOPEN
#define FOPEN(f, m) fopen(f, m)
+ #define FCLOSE(f) fclose(f)
#define FTRUNCATE(f, l) ftruncate(f, l)
#define OPENDIR(d) opendir(d)
+ #define CLOSEDIR(d) closedir(d)
+ #define READDIR(d) readdir(d)
#define OPEN open
#define CHDIR(d) chdir(d)
#define CLOSE(f) close(f)
#define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
#define SYMLINK(a, b) symlink(a, b)
#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) mkfifo(p, m)
+ #define MSYNC(s, l, f) msync(s, l, f)
#define MUNMAP(s, l) munmap(s, l)
#define STRERROR(i) strerror(i)
#define RANDOM() random()
#define PLIBC_CTIME(c) _win_ctime(c)
#define CTIME_R(c, b) _win_ctime_r(c, b)
#define FOPEN(f, m) _win_fopen(f, m)
+ #define FCLOSE(f) _win_fclose(f)
#define FTRUNCATE(f, l) _win_ftruncate(f, l)
#define OPENDIR(d) _win_opendir(d)
+ #define CLOSEDIR(d) _win_closedir(d)
+ #define READDIR(d) _win_readdir(d)
#define OPEN _win_open
#define CHDIR(d) _win_chdir(d)
#define CLOSE(f) _win_close(f)
#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
#define SYMLINK(a, b) _win_symlink(a, b)
#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) _win_mkfifo(p, m)
+ #define MSYNC(s, l, f) _win_msync(s, l, f)
#define MUNMAP(s, l) _win_munmap(s, l)
#define STRERROR(i) _win_strerror(i)
#define READLINK(p, b, s) _win_readlink(p, b, s)