if OS_WIN32
arch_sources = fnmatch.c \
- w32_dirent.c w32_reg.c w32_signal.c w32_stat.c \
+ w32_reg.c w32_signal.c w32_stat.c \
w32_stdio.c w32_stdlib.c w32_string.c w32_time.c \
w32_unistd.c w32_wait.c w32_account.c
arch_headers = fnmatch.h w32lib.h
+++ /dev/null
-/* w32_dirent.c - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <windows.h>
-#include <dirent.h>
-
-#include "w32lib.h"
-
-
-
-DIR *
-opendir ( const char *name )
-{
- DIR *dir;
-
- dir = calloc (1, sizeof *dir + strlen (name));
- if (!dir)
- return NULL;
- strcpy (dir->dd_name, name);
- return dir;
-}
-
-int
-closedir (DIR *dir)
-{
- FindClose( (HANDLE)dir->dd_handle );
- free( dir );
- return 0;
-}
-
-struct dirent *
-readdir( DIR *dir )
-{
- WIN32_FIND_DATA fInfo;
- struct dirent *xdirent;
- int ret;
-
- if ( !dir->dd_handle )
- {
- char *dirname;
-
- if (*dir->dd_name)
- {
- size_t n = strlen (dir->dd_name);
- dirname = malloc (n + 4 + 1);
- if (dirname) {
- strcpy (dirname, dir->dd_name);
- strcpy (dirname + n, "\\*.*");
- }
- }
- else
- dirname = strdup( "\\*.*" );
- if (!dirname)
- return NULL; /* Error. */
-
- dir->dd_handle = (long)FindFirstFile( dirname, &fInfo );
- free( dirname );
- if ( !dir->dd_handle )
- ret = 0;
- else
- ret = 1;
- }
- else if ( dir->dd_handle != -1l )
- {
- ret = FindNextFile ((HANDLE)dir->dd_handle, &fInfo);
- }
- else
- ret = 0;
- if ( !ret )
- return NULL;
-
- xdirent = calloc ( 1, sizeof *xdirent);
- if (xdirent)
- {
- strncpy (xdirent->d_name, fInfo.cFileName, FILENAME_MAX -1 );
- xdirent->d_name[FILENAME_MAX-1] = 0;
- xdirent->d_namlen = strlen( xdirent->d_name );
- }
- return xdirent;
-}
#include "w32lib.h"
+#if MINGW64_VERSION < 200
FILE *popen( const char *command, const char *type ){
return NULL;
}
+#endif
int pclose( FILE *stream ){
return -1;
srand( seed );
}
+#if MINGW64_VERSION < 200
int truncate( const char *path, off_t length ){
return -1;
}
+#endif
#include "w32lib.h"
+#if MINGW64_VERSION < 200
int strcasecmp( const char *s1, const char *s2 ){
size_t len1, len2, len;
return 0;
}
-
+#endif /* MINGW64_VERSION < 200 */
#include "w32lib.h"
#if ! defined (__MINGW32__) || MINGW32_VERSION < 312
+# if MINGW64_VERSION < 200
int gettimeofday( struct timeval *tv, struct timezone *tz ){
struct _timeb tstruct;
_ftime( &tstruct );
tv->tv_usec = tstruct.millitm;
return 1;
}
+# endif
#endif
#include <stdio.h>
#ifdef __MINGW32__
-#include <_mingw.h>
-#define MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 100 \
+# include <_mingw.h>
+# define MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 100 \
+ __MINGW32_MINOR_VERSION)
-#include <wchar.h>
-#include <dirent.h>
-#include <sys/time.h>
-#endif
+# define MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 100 \
+ + __MINGW64_VERSION_MINOR)
+# include <wchar.h>
+# include <dirent.h>
+# include <sys/time.h>
+# if MINGW64_VERSION >= 200
+# include <sys/types.h>
+# endif
+#endif /* __MINGW32__ */
#include <glib/gstdio.h>
/* functions */
/*** str ***/
+#if MINGW64_VERSION < 200
int strcasecmp( const char *s1, const char *s2 );
-
int strncasecmp( const char *s1, const char *s2, size_t n );
+#endif
/*** dir ***/
#ifndef __MINGW32__
#endif /* !__MINGW32__ */
-
-DIR *opendir( const char *name );
-int closedir( DIR *dir );
-struct dirent *readdir( DIR *dir );
-
#if defined (__MINGW32__) && MINGW32_VERSION < 312
+# if MINGW64_VERSION < 200
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
+# endif
#endif
/*** stat ***/
/*** sys/time ***/
#if ! defined (__MINGW32__) || MINGW32_VERSION < 312
+# if MINGW64_VERSION < 200
int gettimeofday( struct timeval *tv, struct timezone *tz );
+# endif
#endif
/*** unistd ***/
/*** stdlib ***/
long int random( void );
void srandom( unsigned int seed );
+#if MINGW64_VERSION < 200
int truncate( const char *path, off_t length );
+#endif
/*** signal ***/
int kill( pid_t pid, int sig );
/*** stdio ***/
+#if MINGW64_VERSION < 200
FILE *popen( const char *command, const char *type );
int pclose( FILE *stream );
+#endif
/*** w32_account.c ***/
int w32_is_administrator (void);
#define ldap_unbind_ext(ld,x,y) ldap_unbind_s(ld)
#define LDAP_ADMINLIMIT_EXCEEDED LDAP_ADMIN_LIMIT_EXCEEDED
#define timeval l_timeval
+#ifndef LDAP_OPT_SUCCESS
+# define LDAP_OPT_SUCCESS 0
+#endif
#endif
/* Function Prototypes */
GList *ldaputil_read_basedn ( const gchar *host, const gint port,