commit e712990b9ded5e61a32e9182487e026841c4362e
parent bc299e87d050f7c6a4baac3c12c6e27fb7125f60
Author: Nils Durner <durner@gnunet.org>
Date: Sun, 10 Jul 2005 20:08:51 +0000
support for new MinGW
Diffstat:
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -173,7 +173,7 @@ AC_FUNC_VPRINTF
AC_FUNC_MMAP
AC_FUNC_STAT
AC_FUNC_ERROR_AT_LINE
-AC_CHECK_FUNCS([mkstemp strndup munmap strcasecmp strdup strncasecmp memmove memset strtoul floor getcwd pow setenv sqrt strchr strcspn strrchr strnlen strndup])
+AC_CHECK_FUNCS([mkstemp strndup munmap strcasecmp strdup strncasecmp memmove memset strtoul floor getcwd pow setenv sqrt strchr strcspn strrchr strnlen strndup ftruncate])
AM_GNU_GETTEXT_VERSION(0.14)
AM_GNU_GETTEXT([external])
diff --git a/src/include/plibc.h b/src/include/plibc.h
@@ -22,7 +22,7 @@
* @brief PlibC header
* @attention This file is usually not installed under Unix,
* so ship it with your application
- * @version $Revision: 1.19 $
+ * @version $Revision: 1.24 $
*/
#ifndef _PLIBC_H_
@@ -43,6 +43,7 @@ extern "C" {
#ifdef WINDOWS
#include <windows.h>
+#include <Ws2tcpip.h>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
@@ -62,11 +63,21 @@ extern "C" {
#define socklen_t int
#define ssize_t int
+#ifndef HAVE_FTRUNCATE
#define ftruncate chsize
+#endif
#define off_t int
#define int64_t long long
#define int32_t long
+#ifndef pid_t
+ #define pid_t int
+#endif
+
+#ifndef WEXITSTATUS
+ #define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
+#endif
+
/* Thanks to the Cygwin project */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
@@ -327,6 +338,7 @@ int _win_rmdir(const char *path);
int _win_access( const char *path, int mode );
int _win_chmod(const char *filename, int pmode);
char *realpath(const char *file_name, char *resolved_name);
+long _win_random(void);
int _win_remove(const char *path);
int _win_rename(const char *oldname, const char *newname);
int _win_stat(const char *path, struct stat *buffer);
@@ -356,6 +368,7 @@ int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
int _win_vscanf(const char *format, va_list arg_ptr);
int _win_scanf(const char *format, ...);
int _win_fscanf(FILE *stream, const char *format, ...);
+pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
int _win_bind(SOCKET s, const struct sockaddr *name, int namelen);
int _win_connect(SOCKET s,const struct sockaddr *name, int namelen);
int _win_getpeername(SOCKET s, struct sockaddr *name,
@@ -423,6 +436,7 @@ size_t strnlen (const char *str, size_t maxlen);
#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
#define MUNMAP(s, l) munmap(s, l)
#define STRERROR(i) strerror(i)
+ #define RANDOM() random()
#define READLINK(p, b, s) readlink(p, b, s)
#define LSTAT(p, b) lstat(p, b)
#define PRINTF(f, ...) printf(f , __VA_ARGS__)
@@ -439,6 +453,7 @@ size_t strnlen (const char *str, size_t maxlen);
#define VSCANF(f, a) vscanf(f, a)
#define SCANF(f, ...) scanf(f, __VA_ARGS__)
#define FSCANF(s, f, ...) fscanf(s, f, __VA_ARGS__)
+ #define WAITPID(p, s, o) waitpid(p, s, o)
#define ACCEPT(s, a, l) accept(s, a, l)
#define BIND(s, n, l) bind(s, n, l)
#define CONNECT(s, n, l) connect(s, n, l)
@@ -475,6 +490,7 @@ size_t strnlen (const char *str, size_t maxlen);
#define ACCESS(p, m) _win_access(p, m)
#define CHMOD(f, p) _win_chmod(f, p)
#define PIPE(h) _win_pipe(h)
+ #define RANDOM() _win_random()
#define REMOVE(p) _win_remove(p)
#define RENAME(o, n) _win_rename(o, n)
#define STAT(p, b) _win_stat(p, b)
@@ -503,6 +519,7 @@ size_t strnlen (const char *str, size_t maxlen);
#define VSCANF(f, a) _win_vscanf(f, a)
#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
+ #define WAITPID(p, s, o) _win_waitpid(p, s, o)
#define ACCEPT(s, a, l) _win_accept(s, a, l)
#define BIND(s, n, l) _win_bind(s, n, l)
#define CONNECT(s, n, l) _win_connect(s, n, l)