[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: 113-gary-factor-windows-dirent-emulation.patch
From: |
Gary V. Vaughan |
Subject: |
FYI: 113-gary-factor-windows-dirent-emulation.patch |
Date: |
Sat, 3 Apr 2004 03:41:10 +0100 (BST) |
User-agent: |
mailnotify/0.3 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Okay to commit?
Cheers,
Gary.
- --
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
_________________________________________________________
This patch notification generated by tlaapply version 0.1
http://savannah.gnu.org/projects/cvsutils
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)
iD8DBQFAbiRGFRMICSmD1gYRAmkxAJ0YX07UTmTOjhrqzt3ilcQPyE9fEACfQpb6
a9WcCbMsq5sjvYlhBlZJSvY=
=C6KA
-----END PGP SIGNATURE-----
* looking for address@hidden/libtool--gary--1.0--patch-3 to compare with
* comparing to address@hidden/libtool--gary--1.0--patch-3
A libltdl/.arch-ids/lt__dirent.c.id
A libltdl/.arch-ids/lt__dirent.h.id
A libltdl/.arch-ids/lt__private.h.id
A libltdl/lt__dirent.c
A libltdl/lt__dirent.h
A libltdl/lt__private.h
M ChangeLog
M libltdl/ltdl.c
M m4/ltdl.m4
M libltdl/lt_system.h
* modified files
Index: Changelog
from Gary V. Vaughan <address@hidden>
* libltdl/ltdl.c: Move standard headers and preprocessor guards
from here...
* libltdl/lt__private.h: ...to here. New file to declare ltdl's
internal interfaces.
* libltdl/ltdl.c: Include lt__private.h.
* m4/ltdl.m4 (AC_LIB_LTDL): Add lt_dirent to AC_LIBOBJ if all of
opendir, readdir and closedir are missing.
(AC_CHECK_HEADERS): Remove assert.h, ctype.h, errno.h, malloc.h,
stdio.h and stdlib.h; these headers are all available in standard
c89 environments and newer.
* libltdl/lt__private.h: Include them here unconditionally.
* libltdl/lt__dirent.c (opendir, readdir, closedir): New file.
Windows dirent emulation functions moved to here...
* libltdl/ltdl.c (opendir, readdir, closedir): ...from here.
* libltdl/lt__dirent.h: New file. Rename the global symbols from
lt__dirent.c into the lt__ namespace so they don't clash with
other libraries.
--- orig/libltdl/lt_system.h
+++ mod/libltdl/lt_system.h
@@ -41,6 +41,9 @@
# define EXIT_FAILURE 1
#endif
+/* Just pick a big number... */
+#define LT_FILENAME_MAX 2048
+
/* Saves on those hard to debug '\0' typos.... */
#define LT_EOS_CHAR '\0'
--- orig/libltdl/ltdl.c
+++ mod/libltdl/ltdl.c
@@ -27,95 +27,9 @@
*/
-#ifdef HAVE_CONFIG_H
-# include HAVE_CONFIG_H
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_STDIO_H
-# include <stdio.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# if HAVE_STRINGS_H
-# include <strings.h>
-# endif
-#endif
-
-#if HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-
-#if HAVE_MEMORY_H
-# include <memory.h>
-#endif
-
-#if HAVE_ERRNO_H
-# include <errno.h>
-#endif
-
-#if HAVE_ARGZ_H
-# include <argz.h>
-#endif
-
-#if HAVE_ASSERT_H
-# include <assert.h>
-#else
-# define assert(arg) ((void) 0)
-#endif
-
-#include "ltdl.h"
-#include "lt__alloc.h"
-#include "lt__pre89.h"
-
-#if defined(HAVE_CLOSEDIR) && defined(HAVE_OPENDIR) && defined(HAVE_READDIR)
&& defined(HAVE_DIRENT_H)
-/* We have a fully operational dirent subsystem. */
-# include <dirent.h>
-# define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name))
-
-#elif !defined(__WINDOWS__)
-/* We are not on windows, so we can get the same functionality from the
- `direct' API. */
-# define dirent direct
-# define LT_D_NAMLEN(dirent) ((dirent)->d_namlen)
-# if HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-# include <ndir.h>
-# endif
-
-#else /* __WINDOWS__ */
-/* Use some wrapper code to emulate dirent on windows.. */
-# define LT_USE_WINDOWS_DIRENT_EMULATION
-#endif
-
-#if WITH_DMALLOC
-# include <dmalloc.h>
-#endif
-
-
-
-
-/* --- WINDOWS SUPPORT --- */
-
-
-#ifdef DLL_EXPORT
-# define LT_GLOBAL_DATA __declspec(dllexport)
-#else
-# define LT_GLOBAL_DATA
-#endif
+#include "lt__private.h"
-
/* --- MANIFEST CONSTANTS --- */
@@ -141,97 +55,6 @@
#define LT_SYMBOL_OVERHEAD 5
-
-
-# if LT_USE_WINDOWS_DIRENT_EMULATION
-
-# include <windows.h>
-
-# define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name))
-# define dirent lt_dirent
-# define DIR lt_DIR
-
-struct dirent
-{
- char d_name[2048];
- int d_namlen;
-};
-
-typedef struct _DIR
-{
- HANDLE hSearch;
- WIN32_FIND_DATA Win32FindData;
- BOOL firsttime;
- struct dirent file_info;
-} DIR;
-
-static void
-closedir (DIR *entry)
-{
- assert (entry != (DIR *) NULL);
- FindClose (entry->hSearch);
- free ((void *) entry);
-}
-
-
-static DIR *
-opendir (const char *path)
-{
- char file_specification[LT_FILENAME_MAX];
- DIR *entry;
-
- assert (path != (char *) NULL);
- (void) strncpy (file_specification, path, LT_FILENAME_MAX-1);
- (void) strcat (file_specification, "\\");
- entry = (DIR *) malloc (sizeof(DIR));
- if (entry != (DIR *) 0)
- {
- entry->firsttime = TRUE;
- entry->hSearch = FindFirstFile (file_specification,
- &entry->Win32FindData);
-
- if (entry->hSearch == INVALID_HANDLE_VALUE)
- {
- (void) strcat (file_specification, "\\*.*");
- entry->hSearch = FindFirstFile (file_specification,
- &entry->Win32FindData);
- if (entry->hSearch == INVALID_HANDLE_VALUE)
- {
- entry = (free (entry), (DIR *) 0);
- }
- }
- }
-
- return entry;
-}
-
-
-static struct dirent *
-readdir (DIR *entry)
-{
- int status;
-
- if (entry == (DIR *) 0)
- return (struct dirent *) 0;
-
- if (!entry->firsttime)
- {
- status = FindNextFile (entry->hSearch, &entry->Win32FindData);
- if (status == 0)
- return (struct dirent *) 0;
- }
-
- entry->firsttime = FALSE;
- (void) strncpy (entry->file_info.d_name, entry->Win32FindData.cFileName,
- LT_FILENAME_MAX - 1);
- entry->file_info.d_namlen = strlen (entry->file_info.d_name);
-
- return &entry->file_info;
-}
-#endif /* !LT_USE_WINDOWS_DIRENT_EMULATION */
-
-
-
#if ! HAVE_ARGZ_APPEND
# define argz_append rpl_argz_append
@@ -3074,7 +2897,7 @@
assert (dp);
dir_len = LT_STRLEN (dirnam);
- end = dp->d_name + LT_D_NAMLEN(dp);
+ end = dp->d_name + D_NAMLEN(dp);
/* Ignore version numbers. */
{
--- orig/m4/ltdl.m4
+++ mod/m4/ltdl.m4
@@ -105,8 +105,7 @@
[CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])])
AC_SUBST([CONFIG_H])
-AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \
- stdio.h unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h],
+AC_CHECK_HEADERS([memory.h unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h],
[], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([string.h strings.h], [break], [], [AC_INCLUDES_DEFAULT])
@@ -126,8 +125,9 @@
[AC_CHECK_FUNC([bcopy], [AC_DEFINE([HAVE_BCOPY])],
[AC_LIBOBJ([memcpy])])])
+AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
+
AC_REPLACE_FUNCS([memmove strcmp])
-AC_CHECK_FUNCS([closedir opendir readdir])
])# AC_LIB_LTDL
* added files
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt__dirent.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Sat Apr 3 01:42:08 2004 10054.0
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt__dirent.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Sat Apr 3 01:42:08 2004 10054.1
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt__private.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Sat Apr 3 01:50:49 2004 10068.0
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/lt__dirent.c
@@ -0,0 +1,101 @@
+/* lt__dirent.c -- internal directory entry scanning interface
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Originally by Gary V. Vaughan <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include <assert.h>
+#include <stddef.h>
+
+#include "lt__dirent.h"
+
+#if __WINDOWS__
+
+void
+closedir (DIR *entry)
+{
+ assert (entry != (DIR *) NULL);
+ FindClose (entry->hSearch);
+ free ((void *) entry);
+}
+
+
+DIR *
+opendir (const char *path)
+{
+ char file_specification[LT_FILENAME_MAX];
+ DIR *entry;
+
+ assert (path != (char *) 0);
+ (void) strncpy (file_specification, path, LT_FILENAME_MAX-1);
+ (void) strcat (file_specification, "\\");
+ entry = (DIR *) malloc (sizeof(DIR));
+ if (entry != (DIR *) 0)
+ {
+ entry->firsttime = TRUE;
+ entry->hSearch = FindFirstFile (file_specification,
+ &entry->Win32FindData);
+
+ if (entry->hSearch == INVALID_HANDLE_VALUE)
+ {
+ (void) strcat (file_specification, "\\*.*");
+ entry->hSearch = FindFirstFile (file_specification,
+ &entry->Win32FindData);
+ if (entry->hSearch == INVALID_HANDLE_VALUE)
+ {
+ entry = (free (entry), (DIR *) 0);
+ }
+ }
+ }
+
+ return entry;
+}
+
+
+struct dirent *
+readdir (DIR *entry)
+{
+ int status;
+
+ if (entry == (DIR *) 0)
+ return (struct dirent *) 0;
+
+ if (!entry->firsttime)
+ {
+ status = FindNextFile (entry->hSearch, &entry->Win32FindData);
+ if (status == 0)
+ return (struct dirent *) 0;
+ }
+
+ entry->firsttime = FALSE;
+ (void) strncpy (entry->file_info.d_name, entry->Win32FindData.cFileName,
+ LT_FILENAME_MAX - 1);
+ entry->file_info.d_namlen = strlen (entry->file_info.d_name);
+
+ return &entry->file_info;
+}
+
+#endif /*__WINDOWS__*/
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/lt__dirent.h
@@ -0,0 +1,97 @@
+/* lt__dirent.h -- internal directory entry scanning interface
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Originally by Gary V. Vaughan <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#ifndef LT__DIRENT_H
+#define LT__DIRENT_H 1
+
+#ifdef HAVE_CONFIG_H
+# include HAVE_CONFIG_H
+#endif
+
+#include "lt_system.h"
+
+#if defined(HAVE_CLOSEDIR) && defined(HAVE_OPENDIR) && defined(HAVE_READDIR)
&& defined(HAVE_DIRENT_H)
+/* We have a fully operational dirent subsystem. */
+# include <dirent.h>
+# define D_NAMLEN(dirent) (strlen((dirent)->d_name))
+
+#elif !defined(__WINDOWS__)
+/* We are not on windows, so we can get the same functionality from the
+ `direct' API. */
+# define dirent direct
+# define D_NAMLEN(dirent) ((dirent)->d_namlen)
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+
+#else /* __WINDOWS__ */
+/* Use some wrapper code to emulate dirent on windows.. */
+# define WINDOWS_DIRENT_EMULATION 1
+
+# include <windows.h>
+
+# define D_NAMLEN(dirent) (strlen((dirent)->d_name))
+# define dirent lt__dirent
+# define DIR lt__DIR
+# define opendir lt__opendir
+# define readdir lt__readdir
+# define closedir lt__closedir
+
+LT_BEGIN_C_DECLS
+
+struct dirent
+{
+ char d_name[LT_FILENAME_MAX];
+ int d_namlen;
+};
+
+typedef struct
+{
+ HANDLE hSearch;
+ WIN32_FIND_DATA Win32FindData;
+ BOOL firsttime;
+ struct dirent file_info;
+} DIR;
+
+
+DIR * opendir (const char *path);
+struct dirent * readdir (DIR *entry);
+void closedir (DIR *entry);
+
+LT_END_C_DECLS
+
+#endif /*!__WINDOWS__*/
+
+#endif /*!LT__DIRENT_H*/
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/lt__private.h
@@ -0,0 +1,81 @@
+/* lt__private.h -- internal apis for libltdl
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Originally by Gary V. Vaughan <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#ifndef LT__PRIVATE_H
+#define LT__PRIVATE_H 1
+
+#ifdef HAVE_CONFIG_H
+# include HAVE_CONFIG_H
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <assert.h>
+#include <errno.h>
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#else
+# if HAVE_STRINGS_H
+# include <strings.h>
+# endif
+#endif
+#if HAVE_MEMORY_H
+# include <memory.h>
+#endif
+
+#include "lt__alloc.h"
+#include "lt__dirent.h"
+#include "lt__pre89.h"
+#include "lt_system.h"
+#include "ltdl.h"
+
+#if WITH_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#ifdef DLL_EXPORT
+# define LT_GLOBAL_DATA __declspec(dllexport)
+#else
+# define LT_GLOBAL_DATA
+#endif
+
+LT_BEGIN_C_DECLS
+
+#ifndef errno
+extern int errno;
+#endif
+
+LT_END_C_DECLS
+
+#endif /*!LT__PRIVATE_H*/
- FYI: 113-gary-factor-windows-dirent-emulation.patch,
Gary V. Vaughan <=