Re-tweaks for accommodating the windows build and systems that do not have strnlen
This commit is contained in:
@@ -147,6 +147,12 @@ enum {
|
||||
x == '#' || x == '\n' || x == '\r' || x == ';' || x == '\0' \
|
||||
)
|
||||
|
||||
/* Work-around for not having strnlen
|
||||
*/
|
||||
#if !HAVE_STRNLEN
|
||||
#define strnlen(s, l) (strlen(s) < l ? strlen(s) : l)
|
||||
#endif
|
||||
|
||||
#endif /* _COMMON_H */
|
||||
|
||||
/***EOF***/
|
||||
|
||||
@@ -57,13 +57,29 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#define unlink _unlink
|
||||
#define open _open
|
||||
#define close _close
|
||||
#define write _write
|
||||
#define O_WRONLY _O_WRONLY
|
||||
#define O_RDONLY _O_RDONLY
|
||||
#define O_RDWR _O_RDWR
|
||||
#define O_CREAT _O_CREAT
|
||||
#define O_EXCL _O_EXCL
|
||||
#define S_IRUSR _S_IREAD
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#define PATH_SEP '\\'
|
||||
|
||||
/* These are needed for the digest code under windows.
|
||||
*/
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
#define strdup _strdup
|
||||
#else
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
@@ -126,7 +142,13 @@
|
||||
/* Try to cover for those that do not have bzero.
|
||||
*/
|
||||
#if !HAVE_BZERO && HAVE_MEMSET
|
||||
# define bzero(buf, bytes) ((void) memset (buf, 0, bytes))
|
||||
#define bzero(buf, bytes) ((void) memset (buf, 0, bytes))
|
||||
#endif
|
||||
|
||||
/* Work-around for not having strnlen
|
||||
*/
|
||||
#if !HAVE_STRNLEN
|
||||
#define strnlen(s, l) (strlen(s) < l ? strlen(s) : l)
|
||||
#endif
|
||||
|
||||
#endif /* FKO_COMMON_H */
|
||||
|
||||
@@ -33,11 +33,13 @@
|
||||
#include "fko_message.h"
|
||||
#include "fko.h"
|
||||
|
||||
/* for inet_aton() IP validation
|
||||
*/
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifndef WIN32
|
||||
/* for inet_aton() IP validation
|
||||
*/
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
static int
|
||||
have_allow_ip(const char *msg)
|
||||
|
||||
@@ -101,6 +101,9 @@
|
||||
/* Define to 1 if you have the `strndup' function. */
|
||||
#define HAVE_STRNDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strnlen' function. */
|
||||
#define HAVE_STRNLEN 1
|
||||
|
||||
/* Define to 1 if you have the `strrchr' function. */
|
||||
#define HAVE_STRRCHR 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user