diff -r b363f8ef6dcb -r 9b4bbbae3a98 openpkg/rpm.patch.porting
--- a/openpkg/rpm.patch.porting Tue Jul 31 12:27:54 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1539 +0,0 @@
-##
-## rpm.patch.porting -- Annotated OpenPKG RPM Patch file
-## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
-## Copyright (c) 2000-2007 Ralf S. Engelschall
-##
-## This file assembles changes to existing RPM source files between
-## the original RedHat RPM and the OpenPKG RPM variant. It can be
-## automatically applied to a vanilla RedHat RPM source tree with the
-## 'patch' tool to upgrade those files. Each patch snippet is annotated
-## with a short description.
-##
-## Created on: 13-Sep-2006
-##
-## ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
-## RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
-##
-
-+---------------------------------------------------------------------------
-| Evil hack to get GNU libtool working under NetBSD 1.6
-| with the ugly way RPM currently has to use it.
-+---------------------------------------------------------------------------
-Index: ltconfig
---- ltconfig 17 Jan 2001 16:22:58 -0000 1.1.1.7
-+++ ltconfig 29 Apr 2004 13:07:28 -0000 1.4
-@@ -2017,6 +2017,7 @@
- dynamic_linker='NetBSD ld.elf_so'
- fi
- shlibpath_var=LD_LIBRARY_PATH
-+ deplibs_check_method=pass_all
- ;;
-
- openbsd*)
-
-+---------------------------------------------------------------------------
-| Disable special RedHat NPTL handling.
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:40:20 -0000
-@@ -151,10 +151,10 @@
- dnl XXX Test for libpthread.a that is NPTL aware (static link only).
- dnl
- LDFLAGS_NPTL=
--if test -f /usr/lib/nptl/libpthread.a ; then
-- LDFLAGS_NPTL="-L/usr/lib/nptl"
--# INCPATH="$INCPATH -I/usr/include/nptl"
--fi
-+dnl if test -f /usr/lib/nptl/libpthread.a ; then
-+dnl LDFLAGS_NPTL="-L/usr/lib/nptl"
-+dnl # INCPATH="$INCPATH -I/usr/include/nptl"
-+dnl fi
- AC_SUBST(LDFLAGS_NPTL)
-
- dnl
-
-+---------------------------------------------------------------------------
-| Disable any POSIX Pthread stuff because in OpenPKG we use
-| non-Pthread mutexes in Berkeley-DB.
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:40:21 -0000
-@@ -447,14 +447,17 @@
- AC_CHECK_LIB(socket, socket)
- ])
-
--AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
-+dnl # required for HP-UX because of RPC stuff in DB
-+AC_CHECK_LIB(nsl, svc_run)
-
--AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
-- dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
-- AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
-- AC_CHECK_LIB(thread, mutex_lock)
-- ])
--])
-+dnl AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
-+dnl
-+dnl AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
-+dnl dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
-+dnl AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
-+dnl AC_CHECK_LIB(thread, mutex_lock)
-+dnl ])
-+dnl ])
-
- AC_CHECK_HEADERS(aio.h)
- AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
-
-+---------------------------------------------------------------------------
-| Add support for BSD getmntinfo(3).
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:40:23 -0000
-@@ -967,12 +967,13 @@
- AC_CHECK_FUNCS(getpassphrase)
-
- AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
-+ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have the getmntinfo() function]), [
- AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
- AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
- AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
- AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
- AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
-- AC_LIBOBJ(getmntent)])])])])
-+ AC_LIBOBJ(getmntent)])])])])])
-
- AC_CHECK_FUNC(lchown,
- [__CHOWN_RHF="%{__chown} -Rhf"
-
-+---------------------------------------------------------------------------
-| Remove RPM's "lib64" hack because we do not install
-| into any system locations at all.
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:40:25 -0000
-@@ -1146,9 +1146,6 @@
-
- dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
- MARK64=
--case "${target_cpu}" in
--x86_64*|ppc64*|powerpc64*|sparc64*|s390x*) MARK64=64 ;;
--esac
- AC_SUBST(MARK64)
-
- dnl Determine the canonical arch-vendor-os for the build machine
-
-+---------------------------------------------------------------------------
-| Provide fallback definitions for uintX_t stuff, which is used by
-| build/rpmfile.h and not available on all platforms. We do this by
-| adding the same Autoconf checks file/configure already used for its
-| original file.h.
-| Additionally, do not try to configure in an internal
-| beecrypt subdirectory.
-+---------------------------------------------------------------------------
-Index: configure.ac
---- configure.ac 2 Jul 2003 19:20:52 -0000 1.1.1.4
-+++ configure.ac 13 Sep 2006 13:40:29 -0000
-@@ -1251,11 +1251,40 @@
-
- AC_SUBST(OBJDUMP)
-
-+dnl OpenPKG: rpmfile.h (used in RPM) from file(1) needs additional checks
-+dnl for its use of uintXX_t (which are available in file/config.h, but which
-+dnl we cannot include into RPM because of conflicts with RPM's config.h)
-+AC_DEFUN([AC_CHECK_TYPE_STDC],
-+[AC_REQUIRE([AC_HEADER_STDC])dnl
-+AC_MSG_CHECKING(for $1)
-+AC_CACHE_VAL(ac_cv_type_$1,
-+[AC_EGREP_CPP(dnl
-+[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
-+[#if HAVE_STDINT_H
-+#include
-+#endif
-+#include
-+#if STDC_HEADERS
-+#include
-+#include
-+#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
-+AC_MSG_RESULT($ac_cv_type_$1)
-+if test $ac_cv_type_$1 = no; then
-+ AC_DEFINE($1, $2, $1)
-+fi])
-+AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
-+AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
-+AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
-+
-+dnl OpenPKG: some strange platforms (like Unixware) really have MADV_XXX
-+dnl but no madvise(2) function itself, so check for madvise explicitly.
-+AC_CHECK_FUNC(madvise)
-+
- dnl XXX this causes popt to depend on zlib et al
- dnl # XXX Propagate -lucb to popt ...
- dnl export LIBS INCPATH CONFIG_SITE
-
--AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3)
-+AC_CONFIG_SUBDIRS(popt zlib elfutils file db3)
-
- AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
- rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
-
-+---------------------------------------------------------------------------
-| Remove RPM's "lib64" hack because we do not install
-| into any system locations at all.
-+---------------------------------------------------------------------------
-Index: popt/configure.ac
---- popt/configure.ac 27 Mar 2003 17:23:18 -0000 1.1.1.3
-+++ popt/configure.ac 12 May 2004 14:34:35 -0000 1.2
-@@ -53,9 +53,6 @@
-
- dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
- MARK64=
--case "${target_cpu}" in
--x86_64*|powerpc64*|ppc64*|sparc64*|s390x*) MARK64=64 ;;
--esac
- AC_SUBST(MARK64)
-
- AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h)
-
-+---------------------------------------------------------------------------
-| Prevent (at least NetBSD's) gcc 2.95 from optimizing (at least sha1.c)
-| and this way run into a resource (virtual memory) exhaustion situation.
-| Not all Bourne-Shells support embedded TAB characters in
-| here-document style constructs. Insert the TAB character indirectly
-| to workaround problems.
-| Additionally, there is no need to build a shared library version of
-| Berkeley-DB.
-| Finally, enforce the use of the standard UNIX/fcntl mutex type for
-| full portability and to get rid of Pthread library dependencies
-| (which especially are nasty for the external RPM API users).
-+---------------------------------------------------------------------------
-Index: db3/configure
---- db3/configure 18 Jan 2003 14:04:22 -0000 1.1.1.4
-+++ db3/configure 6 Jun 2005 15:53:05 -0000 1.3
-@@ -7,19 +7,29 @@
- # XXX edit CFLAGS= ... out of invocation args ???
- ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
-
-+# prevent gcc 2.95 from optimizing (at least sha1.c)
-+# and this way get into a resource exhaustion situation
-+if [ ".`($CC -v; $CC --version) &1 | grep -i 'gcc'`" != . ]; then
-+ case "`$CC -dumpversion 2>/dev/null`" in
-+ 3.* ) ;;
-+ * ) CFLAGS=`echo " $CFLAGS -O0" | sed -e 's; -O[0-9]* ; ;g' -e 's;^ *;;'` ;;
-+ esac
-+fi
-+
- CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
-- --enable-shared --enable-static --enable-rpc \
-- --with-uniquename=_rpmdb --srcdir=$db_dist
-+ --disable-shared --enable-static --enable-rpc \
-+ --with-uniquename=_rpmdb --srcdir=$db_dist \
-+ --with-mutex="UNIX/fcntl" --disable-largefile
-
- mv Makefile Makefile.orig
- cat Makefile.orig | sed -e '/^install[:-]/c\
- .PHONY: listobjs\
- listobjs:\
-- @echo $(OBJS) $(C_OBJS) \
-+~@echo $(OBJS) $(C_OBJS) \
- \
- distdir install check:\
- \
--db4_install: all install_setip' > Makefile
-+db4_install: all install_setip' | tr '~' ' ' > Makefile
-
- mv db.h db.h.orig
- cat db.h.orig | sed \
-
-+---------------------------------------------------------------------------
-| Add support for BSD getmntinfo(3).
-+---------------------------------------------------------------------------
-Index: lib/fs.c
---- lib/fs.c 4 Jun 2003 18:09:43 -0000 1.1.1.13
-+++ lib/fs.c 25 Nov 2004 09:32:16 -0000 1.3
-@@ -164,6 +164,15 @@
- int nextMount = 0;
-
- getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
-+# elif HAVE_GETMNTINFO
-+# if defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)
-+# define statfs statvfs
-+# endif
-+ struct statfs * mounts = NULL;
-+ int mntCount, flags = MNT_NOWAIT;
-+ int nextMount = 0;
-+
-+ mntCount = getmntinfo(&mounts, flags);
- # endif
-
- filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems)); /* XXX memory leak */
-@@ -193,6 +202,9 @@
- # elif HAVE_GETMNTINFO_R
- if (nextMount == mntCount) break;
- mntdir = mounts[nextMount++].f_mntonname;
-+# elif HAVE_GETMNTINFO
-+ if (nextMount == mntCount) break;
-+ mntdir = mounts[nextMount++].f_mntonname;
- # endif
-
- if (stat(mntdir, &sb)) {
-
-+---------------------------------------------------------------------------
-| Add support for Compaq/HP OSF1/Tru64.
-+---------------------------------------------------------------------------
-Index: misc/fnmatch.h
---- misc/fnmatch.h 22 Feb 2002 17:12:15 -0000 1.1.1.3
-+++ misc/fnmatch.h 22 Jan 2004 21:42:26 -0000 1.2
-@@ -55,7 +55,7 @@
- #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
- #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
-
--#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
-+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE || defined __osf__
- # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
- # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
- # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
-
-+---------------------------------------------------------------------------
-| Use more correct Autoconf based size_t check.
-| Add support for Compaq/HP OSF1/Tru64 and SCO UnixWare.
-+---------------------------------------------------------------------------
-Index: misc/glob.h
---- misc/glob.h 11 Mar 2000 20:59:30 -0000 1.1.1.3
-+++ misc/glob.h 22 Jan 2004 21:42:27 -0000 1.2
-@@ -46,7 +46,7 @@
- #endif /* C++ or ANSI C. */
-
- /* We need `size_t' for the following definitions. */
--#ifndef __size_t
-+#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
- # if defined __GNUC__ && __GNUC__ >= 2
- typedef __SIZE_TYPE__ __size_t;
- # ifdef _XOPEN_SOURCE
-@@ -74,7 +74,7 @@
- #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
-
- #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \
-- || defined _GNU_SOURCE)
-+ || defined _GNU_SOURCE || defined __osf__ )
- # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
- # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
- # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
-@@ -151,7 +151,8 @@
- `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
- If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
- Otherwise, `glob' returns zero. */
--#if _FILE_OFFSET_BITS != 64
-+/* #if _FILE_OFFSET_BITS != 64 || defined(OPENPKG_UNIXWARE) */
-+#if !defined(__linux__)
- extern int glob __P ((__const char *__pattern, int __flags,
- int (*__errfunc) (__const char *, int),
- glob_t *__pglob));
-
-+---------------------------------------------------------------------------
-| Better portability.
-+---------------------------------------------------------------------------
-Index: misc/glob.c
---- misc/glob.c 11 Mar 2000 21:13:18 -0000 1.1.1.4
-+++ misc/glob.c 22 Jan 2004 21:42:26 -0000 1.2
-@@ -813,6 +813,7 @@
-
-
- /* Free storage allocated in PGLOB by a previous `glob' call. */
-+#if !defined(__linux__) || (defined(__linux__) && (_FILE_OFFSET_BITS != 64) || (__GNUC__ >= 2))
- void
- globfree (pglob)
- register glob_t *pglob;
-@@ -826,7 +827,7 @@
- free ((__ptr_t) pglob->gl_pathv);
- }
- }
--
-+#endif
-
- /* Do a collated comparison of A and B. */
- static int
-
-+---------------------------------------------------------------------------
-| Add libmisc.a for platform portability.
-+---------------------------------------------------------------------------
-Index: tools/Makefile.am
---- tools/Makefile.am 29 May 2003 17:40:17 -0000 1.1.1.14
-+++ tools/Makefile.am 22 Jan 2004 21:42:34 -0000 1.2
-@@ -22,7 +22,7 @@
-
- LDADD = \
- $(top_builddir)/lib/librpm.la \
-- @INTLLIBS@
-+ @INTLLIBS@ @LIBMISC@
-
- staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
-
-
-+---------------------------------------------------------------------------
-| Add libmisc.a for platform portability.
-+---------------------------------------------------------------------------
-Index: tools/Makefile.in
---- tools/Makefile.in 16 Jul 2003 17:05:51 -0000 1.1.1.20
-+++ tools/Makefile.in 22 Jan 2004 21:42:35 -0000 1.2
-@@ -275,7 +275,7 @@
-
- LDADD = \
- $(top_builddir)/lib/librpm.la \
-- @INTLLIBS@
-+ @INTLLIBS@ @LIBMISC@
-
-
- staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
-
-+---------------------------------------------------------------------------
-| Drop GCC "inline" attribute if not compiling with GCC.
-| Workaround some other GCC'isms, too.
-| Do not take over "const" replacements from Zlib.
-+---------------------------------------------------------------------------
-Index: file/system.h
---- file/system.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
-+++ file/system.h 6 Jun 2005 15:53:05 -0000 1.4
-@@ -13,6 +13,9 @@
- #endif
-
- #include
-+#ifdef HAVE_INTTYPES_H
-+#include
-+#endif
-
- #include
- #include
-@@ -53,6 +56,8 @@
- #else
- #if HAVE_ERROR && HAVE_ERROR_H
- #include
-+#else
-+extern void error(int status, int errnum, const char *format, ...);
- #endif
- #endif
-
-@@ -194,6 +199,7 @@
-
- #ifdef HAVE_LIBZ
- #include
-+#undef const
- #endif
-
- #ifndef HAVE_STRERROR
-@@ -246,7 +252,11 @@
- */
- /*@-shadow@*/
- /*@unused@*/ /*@exits@*/ /*@only@*/
-+#if defined(__GNUC__)
- static inline void * vmefail(/*@unused@*/ size_t nb)
-+#else
-+static void * vmefail(/*@unused@*/ size_t nb)
-+#endif
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
- {
-@@ -286,9 +296,33 @@
-
- #if !defined(__LCLINT__)
- /* Memory allocation via macro defs to get meaningful locations from mtrace() */
-+#if defined(__GNUC__)
- #define xmalloc(_size) (malloc(_size) ? : vmefail(0))
- #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(0))
- #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(0))
-+#else
-+static void *xmalloc(size_t size)
-+{
-+ void *vp = malloc(size);
-+ if (vp == NULL)
-+ vmefail(0);
-+ return vp;
-+}
-+static void *xcalloc(size_t number, size_t size)
-+{
-+ void *vp = calloc(number, size);
-+ if (vp == NULL)
-+ vmefail(0);
-+ return vp;
-+}
-+static void *xrealloc(void *ptr, size_t size)
-+{
-+ void *vp = realloc(ptr, size);
-+ if (vp == NULL)
-+ vmefail(0);
-+ return vp;
-+}
-+#endif
- #define xstrdup(_str) (strcpy(xmalloc(strlen(_str)+1), (_str)))
- #endif
-
-@@ -314,9 +348,14 @@
-
- #if defined(__LCLINT__)
- #define FILE_RCSID(id)
--#else
-+#elif defined(__GNUC__)
- #define FILE_RCSID(id) \
- static inline const char *rcsid(const char *p) { \
-+ return rcsid(p = id); \
-+}
-+#else
-+#define FILE_RCSID(id) \
-+static const char *rcsid(const char *p) { \
- return rcsid(p = id); \
- }
- #endif
-
-+---------------------------------------------------------------------------
-| Use GCC extensional features only if compiled with GCC.
-+---------------------------------------------------------------------------
-Index: file/file.h
---- file/file.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
-+++ file/file.h 22 Jan 2004 21:42:22 -0000 1.2
-@@ -95,7 +95,11 @@
- } value; /* either number or string */
- uint32_t mask; /* mask before comparison with value */
- char desc[MAXDESC]; /* description */
-+#if defined(__GNUC__)
- } __attribute__((__packed__));
-+#else
-+};
-+#endif
-
- #define BIT(A) (1 << (A))
- #define STRING_IGNORE_LOWERCASE BIT(0)
-
-+---------------------------------------------------------------------------
-| Add int32_t detection and automatic fallback support.
-+---------------------------------------------------------------------------
-Index: file/config.h.in
---- file/config.h.in 7 Mar 2003 19:39:18 -0000 1.1.1.1
-+++ file/config.h.in 13 Sep 2006 13:40:49 -0000
-@@ -106,6 +106,9 @@
- /* Define to 1 if you have the header file. */
- #undef HAVE_UNISTD_H
-
-+/* Define to 1 if you have the `vsnprintf' function. */
-+#undef HAVE_VSNPRINTF
-+
- /* Define to 1 if `major', `minor', and `makedev' are declared in .
- */
- #undef MAJOR_IN_MKDEV
-@@ -162,12 +165,16 @@
- /* Define to empty if `const' does not conform to ANSI C. */
- #undef const
-
-+/* int32_t */
-+#undef int32_t
-+
- /* Define to `long' if does not define. */
- #undef off_t
-
- /* Define to `unsigned' if does not define. */
- #undef size_t
-
-+#ifndef HAVE_STDINT_H
- /* uint16_t */
- #undef uint16_t
-
-@@ -179,3 +186,4 @@
-
- /* uint8_t */
- #undef uint8_t
-+#endif
-
-+---------------------------------------------------------------------------
-| Add int32_t detection and automatic fallback support.
-+---------------------------------------------------------------------------
-Index: file/configure.ac
---- file/configure.ac 1 Dec 2002 21:34:06 -0000 1.1.1.1
-+++ file/configure.ac 6 Jun 2005 15:53:05 -0000 1.2
-@@ -92,6 +92,7 @@
- AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
- AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
- AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
-+AC_CHECK_TYPE_STDC(int32_t, int)
- AC_C_LONG_LONG
- if test $ac_cv_c_long_long = yes; then
- long64='unsigned long long';
-@@ -107,7 +108,7 @@
- AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
-
- dnl Checks for functions
--AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul)
-+AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul vsnprintf)
-
- dnl Checks for libraries
- AC_CHECK_LIB(z, gzopen)
-
-+---------------------------------------------------------------------------
-| Add int32_t detection and automatic fallback support.
-+---------------------------------------------------------------------------
-Index: file/configure
---- file/configure 16 Jul 2003 17:05:25 -0000 1.1.1.2
-+++ file/configure 6 Jun 2005 15:53:05 -0000 1.2
-@@ -10847,6 +10847,46 @@
-
- fi
-
-+echo "$as_me:$LINENO: checking for int32_t" >&5
-+echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
-+if test "${ac_cv_type_int32_t+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+#line $LINENO "configure"
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#if HAVE_STDINT_H
-+#include
-+#endif
-+#include
-+#if STDC_HEADERS
-+#include
-+#include
-+#endif
-+_ACEOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-+ ac_cv_type_int32_t=yes
-+else
-+ ac_cv_type_int32_t=no
-+fi
-+rm -f conftest*
-+
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
-+echo "${ECHO_T}$ac_cv_type_int32_t" >&6
-+if test $ac_cv_type_int32_t = no; then
-+
-+cat >>confdefs.h <<\_ACEOF
-+#define int32_t int
-+_ACEOF
-+
-+fi
-+
- echo "$as_me:$LINENO: checking for long long" >&5
- echo $ECHO_N "checking for long long... $ECHO_C" >&6
- if test "${ac_cv_c_long_long+set}" = set; then
-@@ -11220,7 +11260,8 @@
-
-
-
--for ac_func in error mtrace mkstemp mmap strdup strerror strtoul
-+
-+for ac_func in error mtrace mkstemp mmap strdup strerror strtoul vsnprintf
- do
- as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
- echo "$as_me:$LINENO: checking for $ac_func" >&5
-
-+---------------------------------------------------------------------------
-| Fallback to vsprintf(3) if vsnprintf(3) does not exist.
-+---------------------------------------------------------------------------
-Index: file/print.c
---- file/print.c 24 Jan 2003 19:41:56 -0000 1.1.1.1
-+++ file/print.c 6 Jun 2005 15:53:05 -0000 1.2
-@@ -187,7 +187,11 @@
-
- va_start(va, f);
- /*@-boundswrite@*/
-+#ifdef HAVE_VSNPRINTF
- rc = vsnprintf(fm->obp, fm->nob, f, va);
-+#else
-+ rc = vsprintf(fm->obp, f, va);
-+#endif
- /*@=boundswrite@*/
- va_end(va);
-
-
-+---------------------------------------------------------------------------
-| Use GNU libtool's weaker -static (link with own static libraries)
-| instead of the strong -all-static (link even with static libc, etc),
-| because OpenPKG does not need to be fully static.
-+---------------------------------------------------------------------------
-Index: rpmdb/Makefile.am
---- rpmdb/Makefile.am 2 Jul 2003 20:14:07 -0000 1.1.1.7
-+++ rpmdb/Makefile.am 22 Jan 2004 21:42:29 -0000 1.2
-@@ -18,7 +18,7 @@
- EXTRA_PROGRAMS = tjfn
-
- tjfn_SOURCES = tjfn.c
--tjfn_LDFLAGS = -all-static
-+tjfn_LDFLAGS = -static
- tjfn_LDADD = librpmdb.la
-
- pkgincdir = $(pkgincludedir)
-@@ -180,4 +180,4 @@
- $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
-
- tdbi: librpmdb.la tdbi.o
-- $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
-+ $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
-
-+---------------------------------------------------------------------------
-| Use GNU libtool's weaker -static (link with own static libraries)
-| instead of the strong -all-static (link even with static libc, etc),
-| because OpenPKG does not need to be fully static.
-+---------------------------------------------------------------------------
-Index: rpmdb/Makefile.in
---- rpmdb/Makefile.in 16 Jul 2003 17:05:48 -0000 1.1.1.7
-+++ rpmdb/Makefile.in 22 Jan 2004 21:42:29 -0000 1.2
-@@ -273,7 +273,7 @@
- EXTRA_PROGRAMS = tjfn
-
- tjfn_SOURCES = tjfn.c
--tjfn_LDFLAGS = -all-static
-+tjfn_LDFLAGS = -static
- tjfn_LDADD = librpmdb.la
-
- pkgincdir = $(pkgincludedir)
-@@ -952,7 +952,7 @@
- $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
-
- tdbi: librpmdb.la tdbi.o
-- $(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
-+ $(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
- # Tell versions [3.59,3.63) of GNU make to not export all variables.
- # Otherwise a system limit (for SysV at least) may be exceeded.
- .NOEXPORT:
-
-+---------------------------------------------------------------------------
-| Use GNU libtool's weaker -static (link with own static libraries)
-| instead of the strong -all-static (link even with static libc, etc),
-| because OpenPKG does not need to be fully static.
-+---------------------------------------------------------------------------
-Index: rpmio/Makefile.am
---- rpmio/Makefile.am 5 Jun 2003 12:05:23 -0000 1.1.1.9
-+++ rpmio/Makefile.am 22 Jan 2004 21:42:31 -0000 1.2
-@@ -68,27 +68,27 @@
- tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tdir_SOURCES = tdir.c
--tdir_LDFLAGS = -all-static
-+tdir_LDFLAGS = -static
- tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tfts_SOURCES = tfts.c
--tfts_LDFLAGS = -all-static
-+tfts_LDFLAGS = -static
- tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tglob_SOURCES = tglob.c
--tglob_LDFLAGS = -all-static
-+tglob_LDFLAGS = -static
- tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tinv_SOURCES = tinv.c
--tinv_LDFLAGS = -all-static
-+tinv_LDFLAGS = -static
- tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tkey_SOURCES = tkey.c
--tkey_LDFLAGS = -all-static
-+tkey_LDFLAGS = -static
- tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tring_SOURCES = tring.c
--tring_LDFLAGS = -all-static
-+tring_LDFLAGS = -static
- tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- trpmio_SOURCES = trpmio.c
-
-+---------------------------------------------------------------------------
-| Use GNU libtool's weaker -static (link with own static libraries)
-| instead of the strong -all-static (link even with static libc, etc),
-| because OpenPKG does not need to be fully static.
-| Additionally, remove hard-coded Linux'ism of linking against POSIX
-| rt/pthread libraries (is not needed even under Linux itself) and
-| make sure the build does not break by an empty argument list when
-| iterating over (the not existing) BeeCrypt objects.
-+---------------------------------------------------------------------------
-Index: rpmio/Makefile.in
---- rpmio/Makefile.in 16 Jul 2003 17:05:49 -0000 1.1.1.9
-+++ rpmio/Makefile.in 22 Jan 2004 21:42:31 -0000 1.2
-@@ -288,8 +288,7 @@
- librpmio_la_LDFLAGS = -release 4.2 \
- @WITH_BEECRYPT_LIB@ \
- $(top_builddir)/file/libfmagic.la \
-- @WITH_ZLIB_LIB@ \
-- -lrt -lpthread
-+ @WITH_ZLIB_LIB@
-
- librpmio_la_LIBADD = $(BEECRYPTLOBJS)
- librpmio_la_DEPENDENCIES = .created
-@@ -298,27 +297,27 @@
- tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tdir_SOURCES = tdir.c
--tdir_LDFLAGS = -all-static
-+tdir_LDFLAGS = -static
- tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tfts_SOURCES = tfts.c
--tfts_LDFLAGS = -all-static
-+tfts_LDFLAGS = -static
- tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tglob_SOURCES = tglob.c
--tglob_LDFLAGS = -all-static
-+tglob_LDFLAGS = -static
- tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tinv_SOURCES = tinv.c
--tinv_LDFLAGS = -all-static
-+tinv_LDFLAGS = -static
- tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tkey_SOURCES = tkey.c
--tkey_LDFLAGS = -all-static
-+tkey_LDFLAGS = -static
- tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- tring_SOURCES = tring.c
--tring_LDFLAGS = -all-static
-+tring_LDFLAGS = -static
- tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
-
- trpmio_SOURCES = trpmio.c
-@@ -743,8 +742,8 @@
- .created:
- if test X"@WITH_BEECRYPT_SUBDIR@" != X; then \
- ${MAKE} -C $(top_builddir)/@WITH_BEECRYPT_SUBDIR@ listobjs ; \
-- for lo in $(BEECRYPTLOBJS); do \
-- [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
-+ for lo in $(BEECRYPTLOBJS) ''; do \
-+ [ ".$$lo" = . ] || [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
- done \
- fi
- touch $@
-
-+---------------------------------------------------------------------------
-| Add Unixware support.
-+---------------------------------------------------------------------------
-Index: rpmio/fts.h
---- rpmio/fts.h 18 Jan 2003 16:13:17 -0000 1.1.1.3
-+++ rpmio/fts.h 22 Jan 2004 21:42:32 -0000 1.2
-@@ -51,7 +51,7 @@
- # define _LARGEFILE64_SOURCE
- #endif
-
--#if defined(sun)
-+#if defined(sun) || defined(OPENPKG_UNIXWARE)
- # define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
- #endif
-
-
-+---------------------------------------------------------------------------
-| Add FreeBSD/NetBSD/OpenBSD support.
-| Workaround some GCC'isms.
-+---------------------------------------------------------------------------
-Index: rpmio/fts.c
---- rpmio/fts.c 18 Jan 2003 16:13:17 -0000 1.1.1.3
-+++ rpmio/fts.c 8 Jun 2005 13:16:25 -0000 1.5
-@@ -34,6 +34,8 @@
- static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
- #endif /* LIBC_SCCS and not lint */
-
-+#include
-+
- #if defined(_LIBC)
- #include
- #include
-@@ -45,20 +47,52 @@
- #include
- #include
- #else
--#if defined(hpux)
-+#if defined(OPENPKG_HPUX)
- # define _INCLUDE_POSIX_SOURCE
- # define __errno_location() (&errno)
--# define dirfd(dirp) -1
-+# define locdirfd(dirp) -1
- # define stat64 stat
- # define _STAT_VER 0
- # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
-+# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
- #endif
--#if defined(sun)
-+#if defined(sun) || defined(OPENPKG_UNIXWARE)
- # define __errno_location() (&errno)
--# define dirfd(dirp) -1
-+# define locdirfd(dirp) -1
- # define _STAT_VER 0
- # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
- #endif
-+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
-+# define __errno_location() (&errno)
-+# define stat64 stat
-+# define _STAT_VER 0
-+# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
-+# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
-+#endif
-+#if defined(__osf__)
-+# define __errno_location() (&errno)
-+# define locdirfd(dirp) -1
-+# define stat64 stat
-+# define _STAT_VER 0
-+# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
-+# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
-+#endif
-+#if defined(OPENPKG_IRIX64)
-+# define __errno_location() (&errno)
-+# define locdirfd(dirp) -1
-+# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
-+# define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
-+#endif
-+#if defined(OPENPKG_AIX)
-+# define __errno_location() (&errno)
-+# define _STAT_VER 0
-+# define locdirfd(dirp) ((dirp)->dd_fd)
-+# define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp))
-+# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
-+#endif
-+#if !defined(locdirfd)
-+# define locdirfd(dirp) dirfd(dirp)
-+#endif
- #include "system.h"
- #include "fts.h"
- #include "rpmio.h"
-@@ -73,7 +107,12 @@
- /* Largest alignment size needed, minus one.
- Usually long double is the worst case. */
- #ifndef ALIGNBYTES
-+#if defined(__GNUC__)
- #define ALIGNBYTES (__alignof__ (long double) - 1)
-+#else
-+/* not accurate enough (usually too large), but sufficient (and this way equal safe) */
-+#define ALIGNBYTES (sizeof (long double) - 1)
-+#endif
- #endif
- /* Align P to that size. */
- #ifndef ALIGN
-@@ -107,9 +146,13 @@
- /*@modifies fileSystem, internalState @*/;
-
- #ifndef MAX
-+#if defined(__GNUC__)
- #define MAX(a, b) ({ __typeof__ (a) _a = (a); \
- __typeof__ (b) _b = (b); \
- _a > _b ? _a : _b; })
-+#else
-+#define MAX(a, b) ((a) > (b) ? (a) : (b))
-+#endif
- #endif
-
- #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
-@@ -719,7 +762,7 @@
- */
- cderrno = 0;
- if (nlinks || type == BREAD) {
-- if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
-+ if (fts_safe_changedir(sp, cur, locdirfd(dirp), NULL)) {
- if (nlinks && type == BREAD)
- cur->fts_errno = errno;
- cur->fts_flags |= FTS_DONTCHDIR;
-
-+---------------------------------------------------------------------------
-| Remove inclusion of system because RPM uses its own glob(3)
-| implementation and this can conflict with the system one.
-+---------------------------------------------------------------------------
-Index: rpmio/rpmio.h
---- rpmio/rpmio.h 12 Jun 2003 18:22:18 -0000 1.1.1.7
-+++ rpmio/rpmio.h 22 Jan 2004 21:42:33 -0000 1.2
-@@ -9,9 +9,6 @@
- #include
- #include
- #include
--/*@-noparams@*/
--#include
--/*@=noparams@*/
- #include
- #include
- #include
-
-+---------------------------------------------------------------------------
-| Make this whole "dirent" fiddling at least working on
-| FreeBSD/NetBSD/OpenBSD, Solaris, HPUX and Unixware. This certainly
-| is a bad corner of RPM which inherently leads to portability
-| problems.
-+---------------------------------------------------------------------------
-Index: rpmio/rpmrpc.c
---- rpmio/rpmrpc.c 29 May 2003 22:14:04 -0000 1.1.1.8
-+++ rpmio/rpmrpc.c 8 Jun 2005 13:16:26 -0000 1.5
-@@ -1079,6 +1079,8 @@
- return rc;
- }
-
-+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_DARWIN)
-+
- struct __dirstream {
- int fd; /* File descriptor. */
- char * data; /* Directory block. */
-@@ -1091,6 +1093,8 @@
- #endif
- };
-
-+#endif
-+
- #if !defined(DT_DIR)
- # define DT_UNKNOWN 0
- # define DT_FIFO 1
-@@ -1101,14 +1105,30 @@
- # define DT_LNK 10
- # define DT_SOCK 12
- # define DT_WHT 14
--typedef struct __dirstream * FTPDIR;
--#else
--typedef DIR * FTPDIR;
- #endif
-
-+struct mydirstreament {
-+ unsigned char type;
-+ char *name;
-+};
-+struct mydirstream {
-+ DIR dir;
-+ struct dirent ent;
-+ unsigned int offset;
-+ unsigned int size;
-+ struct mydirstreament av[1];
-+};
-+typedef struct mydirstream *FTPDIR;
-+
- /*@unchecked@*/
- static int ftpmagicdir = 0x8440291;
--#define ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
-+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_UNIXWARE) && !defined(OPENPKG_DARWIN) && !defined(__osf__) && !defined(OPENPKG_IRIX64) && !defined(OPENPKG_HPUX) && !defined(OPENPKG_AIX)
-+#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
-+#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
-+#else
-+#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
-+#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
-+#endif
-
- /*@-boundswrite@*/
- /*@-type@*/ /* FIX: abstract DIR */
-@@ -1121,8 +1141,7 @@
- struct dirent * dp;
- size_t nb;
- const char * s, * sb, * se;
-- const char ** av;
-- unsigned char * dt;
-+ struct mydirstreament * av;
- char * t;
- int ac;
- int c;
-@@ -1165,28 +1184,22 @@
- }
- }
-
-- nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
-+ nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
- mydir = xcalloc(1, nb);
- /*@-abstract@*/
-- dp = (struct dirent *) (mydir + 1);
-- av = (const char **) (dp + 1);
-- dt = (char *) (av + (ac + 1));
-- t = (char *) (dt + ac + 1);
-+ dp = &mydir->ent;
-+ av = &mydir->av[0];
-+ t = (char *)&mydir->av[ac+1];
- /*@=abstract@*/
-
-- mydir->fd = ftpmagicdir;
--/*@-usereleased@*/
-- mydir->data = (char *) dp;
--/*@=usereleased@*/
-- mydir->allocation = nb;
-- mydir->size = ac;
-- mydir->offset = -1;
-- mydir->filepos = 0;
-+ SETFTPMAGIC((DIR *)mydir);
-+ mydir->size = ac;
-+ mydir->offset = 0;
-
- ac = 0;
- /*@-dependenttrans -unrecog@*/
-- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
-- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
-+ av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, "."); ++ac;
-+ av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
- /*@=dependenttrans =unrecog@*/
- sb = NULL;
- s = se = ftpBuf;
-@@ -1198,34 +1211,34 @@
- /*@switchbreak@*/ break;
- case '\r':
- /*@-dependenttrans@*/
-- av[ac] = t;
-+ av[ac].name = t;
- /*@=dependenttrans@*/
- if (sb == NULL) {
- /*@-unrecog@*/
- switch(*s) {
- case 'p':
-- dt[ac] = DT_FIFO;
-+ av[ac].type = DT_FIFO;
- /*@innerbreak@*/ break;
- case 'c':
-- dt[ac] = DT_CHR;
-+ av[ac].type = DT_CHR;
- /*@innerbreak@*/ break;
- case 'd':
-- dt[ac] = DT_DIR;
-+ av[ac].type = DT_DIR;
- /*@innerbreak@*/ break;
- case 'b':
-- dt[ac] = DT_BLK;
-+ av[ac].type = DT_BLK;
- /*@innerbreak@*/ break;
- case '-':
-- dt[ac] = DT_REG;
-+ av[ac].type = DT_REG;
- /*@innerbreak@*/ break;
- case 'l':
-- dt[ac] = DT_LNK;
-+ av[ac].type = DT_LNK;
- /*@innerbreak@*/ break;
- case 's':
-- dt[ac] = DT_SOCK;
-+ av[ac].type = DT_SOCK;
- /*@innerbreak@*/ break;
- default:
-- dt[ac] = DT_UNKNOWN;
-+ av[ac].type = DT_UNKNOWN;
- /*@innerbreak@*/ break;
- }
- /*@=unrecog@*/
-@@ -1243,7 +1256,7 @@
- /*@switchbreak@*/ break;
- }
- }
-- av[ac] = NULL;
-+ av[ac].name = NULL;
-
- /*@-kepttrans@*/
- return (DIR *) mydir;
-@@ -1258,43 +1271,50 @@
- {
- FTPDIR mydir = (FTPDIR)dir;
- struct dirent * dp;
-- const char ** av;
-- unsigned char * dt;
-+ struct mydirstreament * av;
- int ac;
- int i;
-
- /*@+voidabstract@*/
-- if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
-+ if (dir == NULL || !ISFTPMAGIC(dir)) {
- /* XXX TODO: EBADF errno. */
- return NULL;
- }
- /*@=voidabstract@*/
-
-- dp = (struct dirent *) mydir->data;
-- av = (const char **) (dp + 1);
-+ dp = &mydir->ent;
-+ av = &mydir->av[0];
- ac = mydir->size;
-- dt = (char *) (av + (ac + 1));
-- i = mydir->offset + 1;
-+ i = mydir->offset + 1;
-
- /*@-boundsread@*/
-- if (i < 0 || i >= ac || av[i] == NULL)
-+ if (i < 0 || i >= ac || av[i].name == NULL)
- return NULL;
- /*@=boundsread@*/
-
- mydir->offset = i;
-
-+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
-+ dp->d_ino = i + 1;
-+ dp->d_reclen = 0;
-+ dp->d_type = av[i].type;
-+ strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
-+ dp->d_name[sizeof(dp->d_name)-1] = '\0';
-+ dp->d_namlen = strlen(dp->d_name);
-+#elif defined(OPENPKG_HPUX) || defined(sun) || defined(OPENPKG_UNIXWARE) || defined(__osf__) || defined(OPENPKG_IRIX64) || defined(OPENPKG_AIX)
-+ /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
-+ dp->d_ino = i + 1; /* W2DO? */
-+ dp->d_reclen = 0; /* W2DO? */
-+ strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
-+#else
- /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
- dp->d_ino = i + 1; /* W2DO? */
- dp->d_reclen = 0; /* W2DO? */
--
--#if !defined(hpux) && !defined(sun)
- dp->d_off = 0; /* W2DO? */
--/*@-boundsread@*/
-- dp->d_type = dt[i];
--/*@=boundsread@*/
-+ dp->d_type = av[i].type;
-+ strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
- #endif
-
-- strncpy(dp->d_name, av[i], sizeof(dp->d_name));
- /*@+voidabstract@*/
- if (_ftp_debug)
- fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
-@@ -1313,7 +1333,7 @@
- /*@+voidabstract@*/
- if (_ftp_debug)
- fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
-- if (mydir == NULL || !ISFTPMAGIC(mydir)) {
-+ if (dir == NULL || !ISFTPMAGIC(dir)) {
- /* XXX TODO: EBADF errno. */
- return -1;
- }
-
-+---------------------------------------------------------------------------
-| Remove inclusion of ancient (and since years deprecated)
-| header. This especially makes sure RPM build does not break on
-| strict platforms like FreeBSD 5.
-+---------------------------------------------------------------------------
-Index: system.h
---- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
-+++ system.h 8 Jun 2005 13:15:16 -0000 1.4
-@@ -256,10 +256,6 @@
- #include
- #endif
-
--#if HAVE_MALLOC_H && !defined(__LCLINT__)
--#include
--#endif
--
- /*@-declundef -incondefs @*/ /* FIX: these are macros */
- /**
- */
-
-+---------------------------------------------------------------------------
-| Add support for BSD getmntinfo(3).
-+---------------------------------------------------------------------------
-Index: system.h
---- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
-+++ system.h 8 Jun 2005 13:15:16 -0000 1.4
-@@ -546,7 +546,7 @@
- #define lchown chown
- #endif
-
--#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
-+#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
- # define GETMNTENT_ONE 0
- # define GETMNTENT_TWO 0
- # if HAVE_SYS_MNTCTL_H
-
-+---------------------------------------------------------------------------
-| Drop GCC "inline" attribute if not compiling with GCC.
-+---------------------------------------------------------------------------
-Index: system.h
---- system.h 1 Mar 2003 19:53:08 -0000 1.1.1.10
-+++ system.h 8 Jun 2005 13:15:16 -0000 1.4
-@@ -599,11 +599,24 @@
-
- #if defined(__LCLINT__)
- #define FILE_RCSID(id)
--#else
-+#elif defined(__GNUC__)
- #define FILE_RCSID(id) \
- static inline const char *rcsid(const char *p) { \
- return rcsid(p = id); \
- }
-+#else
-+#define FILE_RCSID(id) \
-+static const char *rcsid(const char *p) { \
-+ return rcsid(p = id); \
-+}
-+#endif
-+
-+/* for basename(3) and dirname(3) */
-+#if !defined(OPENPKG_AIX)
-+#include
-+#endif
-+#if defined(OPENPKG_AIX)
-+#define unsetenv(x) /* unsetenv() is used in RPM just for malloc debugging purposes */
- #endif
-
- #endif /* H_SYSTEM */
-
-+---------------------------------------------------------------------------
-| Remove GCC'ism.
-+---------------------------------------------------------------------------
-Index: build/rpmfile.h
---- build/rpmfile.h 24 Jan 2003 19:41:56 -0000 1.1.1.1
-+++ build/rpmfile.h 22 Jan 2004 21:42:14 -0000 1.2
-@@ -95,7 +95,11 @@
- } value; /* either number or string */
- uint32_t mask; /* mask before comparison with value */
- char desc[MAXDESC]; /* description */
-+#if defined(__GNUC__)
- } __attribute__((__packed__));
-+#else
-+};
-+#endif
-
- #define BIT(A) (1 << (A))
- #define STRING_IGNORE_LOWERCASE BIT(0)
-
-+---------------------------------------------------------------------------
-| Better portability for madvise(2) usage.
-+---------------------------------------------------------------------------
-Index: rpmdb/legacy.c
---- rpmdb/legacy.c 18 Dec 2002 22:40:19 -0000 1.1.1.4
-+++ rpmdb/legacy.c 22 Jan 2004 21:42:30 -0000 1.2
-@@ -182,7 +182,7 @@
- break;
- }
-
--#ifdef MADV_SEQUENTIAL
-+#if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)
- xx = madvise(mapped, fsize, MADV_SEQUENTIAL);
- #endif
-
-
-+---------------------------------------------------------------------------
-| Better portability for madvise(2) usage.
-+---------------------------------------------------------------------------
-Index: lib/fsm.c
---- lib/fsm.c 3 Mar 2003 21:28:12 -0000 1.1.1.5
-+++ lib/fsm.c 22 Jan 2004 21:42:23 -0000 1.2
-@@ -879,7 +879,7 @@
- rdbuf = fsm->rdbuf;
- fsm->rdbuf = (char *) mapped;
- fsm->rdlen = nmapped = st->st_size;
--#if defined(MADV_DONTNEED)
-+#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
- xx = madvise(mapped, nmapped, MADV_DONTNEED);
- #endif
- }
-@@ -909,7 +909,7 @@
- #if HAVE_MMAP
- if (mapped != (void *)-1) {
- xx = msync(mapped, nmapped, MS_ASYNC);
--#if defined(MADV_DONTNEED)
-+#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
- xx = madvise(mapped, nmapped, MADV_DONTNEED);
- #endif
- /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
-
-+---------------------------------------------------------------------------
-| Support UnixWare 7.1.3 and OpenDarwin 6.6.2, too.
-+---------------------------------------------------------------------------
-Index: aclocal.m4
---- aclocal.m4 16 Jul 2003 17:05:28 -0000 1.1.1.10
-+++ aclocal.m4 6 Jun 2005 15:53:03 -0000 1.4
-@@ -2838,7 +2838,7 @@
- runpath_var=LD_RUN_PATH
- ;;
-
-- sysv5uw7* | unixware7*)
-+ sysv5uw7* | unixware7* | sysv5UnixWare7* )
- no_undefined_flag='${wl}-z ${wl}text'
- if test "$GCC" = yes; then
- archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-@@ -4311,6 +4311,7 @@
- ;;
- *) # Darwin 1.3 on
- lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
-+ lt_cv_deplibs_check_method=pass_all
- ;;
- esac
- ;;
-@@ -4336,7 +4337,7 @@
- ;;
-
- hpux10.20*|hpux11*)
-- lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
-+ lt_cv_deplibs_check_method='pass_all'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/libc.sl
- ;;
-@@ -4375,11 +4376,7 @@
- ;;
-
- netbsd*)
-- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
-- lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
-- else
-- lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
-- fi
-+ lt_cv_deplibs_check_method='pass_all'
- ;;
-
- newos6*)
-@@ -4414,7 +4411,7 @@
- lt_cv_file_magic_test_file=/lib/libc.so
- ;;
-
--sysv5uw[[78]]* | sysv4*uw2*)
-+sysv5uw[[78]]* | sysv4*uw2* | sysv5UnixWare7* )
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-
-+---------------------------------------------------------------------------
-| Use Linux i386 assembly specific stuff on Linux only.
-+---------------------------------------------------------------------------
-Index: rpmio/rpmsw.c
---- rpmio/rpmsw.c 5 Jun 2003 12:04:05 -0000 1.1.1.1
-+++ rpmio/rpmsw.c 22 Jan 2004 21:42:33 -0000 1.2
-@@ -27,7 +27,7 @@
- /*@unchecked@*/
- static int rpmsw_initialized = 0;
-
--#if defined(__i386__)
-+#if defined(__linux__) && defined(__i386__)
- /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */
-
- #define HP_TIMING_ZERO(Var) (Var) = (0)
-
-+---------------------------------------------------------------------------
-| Fix "environ" declaration.
-+---------------------------------------------------------------------------
-Index: lib/signature.c
---- lib/signature.c 29 May 2003 18:42:23 -0000 1.1.1.23
-+++ lib/signature.c 22 Jan 2004 21:42:25 -0000 1.2
-@@ -27,7 +27,7 @@
- /*@access pgpDigParams@*/
-
- #if !defined(__GLIBC__)
--char ** environ = NULL;
-+extern char ** environ;
- #endif
-
- int rpmLookupSignatureType(int action)
-
-+---------------------------------------------------------------------------
-| Rename own mergesort(3) implementation to avoid conflicts
-| with a possibly existing vendor version.
-+---------------------------------------------------------------------------
-Index: rpmdb/merge.c
---- rpmdb/merge.c 22 Jun 2002 18:51:58 -0000 1.1.1.2
-+++ rpmdb/merge.c 22 Jan 2004 21:42:30 -0000 1.2
-@@ -204,7 +204,7 @@
- * Arguments are as for qsort.
- */
- int
--mergesort(void *base, size_t nmemb, size_t size,
-+rpmdb_mergesort(void *base, size_t nmemb, size_t size,
- int (*cmp) (const void *, const void *))
- {
- register int i, sense;
-
-+---------------------------------------------------------------------------
-| Rename own mergesort(3) implementation to avoid conflicts
-| with a possibly existing vendor version.
-+---------------------------------------------------------------------------
-Index: rpmdb/rpmdb.h
---- rpmdb/rpmdb.h 18 Jan 2003 14:04:35 -0000 1.1.1.5
-+++ rpmdb/rpmdb.h 22 Jan 2004 21:42:31 -0000 1.2
-@@ -1080,7 +1080,7 @@
- * Mergesort, same arguments as qsort(2).
- */
- /*@unused@*/
--int mergesort(void *base, size_t nmemb, size_t size,
-+int rpmdb_mergesort(void *base, size_t nmemb, size_t size,
- int (*cmp) (const void *, const void *))
- /*@globals errno @*/
- /*@modifies base, errno @*/;
-
-+---------------------------------------------------------------------------
-| Rename own mergesort(3) implementation to avoid conflicts
-| with a possibly existing vendor version.
-+---------------------------------------------------------------------------
-Index: rpmdb/rpmdb.c
---- rpmdb/rpmdb.c 2 Jul 2003 19:21:54 -0000 1.1.1.6
-+++ rpmdb/rpmdb.c 22 Jan 2004 21:42:30 -0000 1.2
-@@ -2361,7 +2361,7 @@
- sizeof(*mi->mi_set->recs), hdrNumCmp);
- /*@=boundsread@*/
- #else
-- mergesort(mi->mi_set->recs, mi->mi_set->count,
-+ rpmdb_mergesort(mi->mi_set->recs, mi->mi_set->count,
- sizeof(*mi->mi_set->recs), hdrNumCmp);
- #endif
- mi->mi_sorted = 1;
-
-+---------------------------------------------------------------------------
-| Workaround a double-inclusion problem under AIX.
-+---------------------------------------------------------------------------
-Index: lib/getdate.y
---- lib/getdate.y 24 Sep 2001 21:53:15 -0000 1.1.1.2
-+++ lib/getdate.y 8 Jun 2005 13:16:22 -0000 1.2
-@@ -30,7 +30,9 @@
- #undef static
- #endif
-
-+#ifndef OPENPKG_AIX
- #include
-+#endif
- #include
-
- /* The code at the top of get_date which figures out the offset of the
-
-+---------------------------------------------------------------------------
-| Workaround a double-inclusion problem under AIX.
-+---------------------------------------------------------------------------
-Index: lib/getdate.c
---- lib/getdate.c 2 Jul 2003 19:21:45 -0000 1.1.1.4
-+++ lib/getdate.c 8 Jun 2005 13:16:21 -0000 1.2
-@@ -50,7 +50,9 @@
- #undef static
- #endif
-
-+#ifndef OPENPKG_AIX
- #include
-+#endif
- #include
-
- /* The code at the top of get_date which figures out the offset of the
-
-+---------------------------------------------------------------------------
-| The following patch works around a general failure of RPM to
-| adhere to the ISO C standard, for which newer GCC releases claim
-| compile errors and fail.
-+---------------------------------------------------------------------------
-Index: misc/err.h
---- misc/err.h 2009-01-06 22:48:16.104430941 +0100
-+++ misc/err.h 2009-01-06 22:47:55.944312482 +0100
-@@ -29,31 +29,4 @@
- # define __gnuc_va_list __ptr_t
- #endif
-
--__BEGIN_DECLS
--
--/* Print "program: ", FORMAT, ": ", the standard error string for errno,
-- and a newline, on stderr. */
--extern void warn __P ((__const char *__format, ...))
-- __attribute__ ((__format__ (__printf__, 1, 2)));
--extern void vwarn __P ((__const char *__format, __gnuc_va_list))
-- __attribute__ ((__format__ (__printf__, 1, 0)));
--
--/* Likewise, but without ": " and the standard error string. */
--extern void warnx __P ((__const char *__format, ...))
-- __attribute__ ((__format__ (__printf__, 1, 2)));
--extern void vwarnx __P ((__const char *__format, __gnuc_va_list))
-- __attribute__ ((__format__ (__printf__, 1, 0)));
--
--/* Likewise, and then exit with STATUS. */
--extern void err __P ((int __status, __const char *__format, ...))
-- __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
--extern void verr __P ((int __status, __const char *__format, __gnuc_va_list))
-- __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
--extern void errx __P ((int __status, __const char *__format, ...))
-- __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
--extern void verrx __P ((int __status, __const char *, __gnuc_va_list))
-- __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
--
--__END_DECLS
--
- #endif /* err.h */