- Better handling when settimeofday is not available.
- Adding name translations for p{close,open} and str{,n}casecmp if
they exists under other names.
diff --git a/dlls/kernel/time.c b/dlls/kernel/time.c
index a18060d..6c6b044 100644
--- a/dlls/kernel/time.c
+++ b/dlls/kernel/time.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@@ -319,10 +321,15 @@
err = 1;
SetLastError(ERROR_INVALID_PARAMETER);
} else {
+#ifdef HAVE_SETTIMEOFDAY
err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
if(err == 0)
return TRUE;
SetLastError(ERROR_PRIVILEGE_NOT_HELD);
+#else
+ err = 1;
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+#endif
}
ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
@@ -407,10 +414,15 @@
err = 1;
SetLastError(ERROR_INVALID_PARAMETER);
} else {
+#ifdef HAVE_SETTIMEOFDAY
err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
if(err == 0)
return TRUE;
SetLastError(ERROR_PRIVILEGE_NOT_HELD);
+#else
+ err = 1;
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+#endif
}
ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
diff --git a/include/wine/port.h b/include/wine/port.h
index aa238cc..b7e0dc0 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -28,9 +28,17 @@
#define _GNU_SOURCE /* for pread/pwrite */
#include <fcntl.h>
#include <sys/types.h>
-#include <sys/time.h>
#include <sys/stat.h>
-#include <unistd.h>
+#ifdef HAVE_DIRECT_H
+# include <direct.h>
+#endif
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
/* Types */
@@ -117,16 +125,16 @@
unsigned long inet_network(const char *cp);
#endif /* !defined(HAVE_INET_NETWORK) */
-#ifndef HAVE_SETTIMEOFDAY
-int settimeofday(struct timeval *tp, void *reserved);
-#endif /* !defined(HAVE_SETTIMEOFDAY) */
-
#ifndef HAVE_STATFS
int statfs(const char *name, struct statfs *info);
#endif /* !defined(HAVE_STATFS) */
#ifndef HAVE_STRNCASECMP
+# ifndef HAVE__STRNICMP
int strncasecmp(const char *str1, const char *str2, size_t n);
+# else
+# define strncasecmp _strnicmp
+# endif
#endif /* !defined(HAVE_STRNCASECMP) */
#ifndef HAVE_OPENPTY
@@ -140,7 +148,11 @@
#endif /* !defined(HAVE_STRERROR) */
#ifndef HAVE_STRCASECMP
+# ifndef HAVE__STRICMP
int strcasecmp(const char *str1, const char *str2);
+# else
+# define strcasecmp _stricmp
+# endif
#endif /* !defined(HAVE_STRCASECMP) */
#ifndef HAVE_USLEEP
@@ -151,6 +163,14 @@
int lstat(const char *file_name, struct stat *buf);
#endif /* HAVE_LSTAT */
+#if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
+#define popen _popen
+#endif
+
+#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
+#define pclose _pclose
+#endif
+
#ifndef HAVE_PREAD
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
#endif /* HAVE_PREAD */
diff --git a/library/port.c b/library/port.c
index 26f1770..f5bba82 100644
--- a/library/port.c
+++ b/library/port.c
@@ -33,7 +33,9 @@
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_h
+# include <sys/time.h>
+#endif
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <errno.h>
@@ -333,20 +335,6 @@
#endif /* defined(HAVE_INET_NETWORK) */
/***********************************************************************
- * settimeofday
- */
-#ifndef HAVE_SETTIMEOFDAY
-int settimeofday(struct timeval *tp, void *reserved)
-{
- tp->tv_sec = 0;
- tp->tv_usec = 0;
-
- errno = ENOSYS;
- return -1;
-}
-#endif /* HAVE_SETTIMEOFDAY */
-
-/***********************************************************************
* statfs
*/
#ifndef HAVE_STATFS