diff options
author | jlam <jlam@pkgsrc.org> | 2004-08-06 16:55:06 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-08-06 16:55:06 +0000 |
commit | d80f435723d764ebf202242ff4359ec5b4d69b11 (patch) | |
tree | df8513e9763ed44e03e6a32670029a3e269938be | |
parent | ca0d568e40036beba63da444c98bd4c77e1fa48b (diff) | |
download | pkgsrc-d80f435723d764ebf202242ff4359ec5b4d69b11.tar.gz |
Update pkgtools/libnbcompat to 20040805. Changes from version 20040512
include:
(1) Add a statvfs() implementation based on statfs(), and remove the
statfs() NetBSD-compatibility implementation. statvfs() is used
in src/usr.sbin/pkg_install on the HEAD branch.
(2) Add a fnmatch() implementation, needed by IRIX. fnmatch() is used
in src/usr.sbin/pkg_install on the HEAD branch.
(3) Remove fseeko(), inet_ntop(), inet_pton(), sl_*() strptime(), and
timegm() as they're not used by any of the bootstrap packages that
require libnbcompat (pax, mtree, pkg_install). All that's left is
what's necessary to bootstrap those three packages.
24 files changed, 2122 insertions, 2535 deletions
diff --git a/doc/CHANGES b/doc/CHANGES index 0b28d53c0b0..66a9d3a7c1e 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,4 +1,4 @@ -$NetBSD: CHANGES,v 1.6812 2004/08/06 16:04:13 schmonz Exp $ +$NetBSD: CHANGES,v 1.6813 2004/08/06 16:55:06 jlam Exp $ Changes to the packages collection and infrastructure in 2004: @@ -3748,3 +3748,4 @@ Changes to the packages collection and infrastructure in 2004: Added amavisd-new-20040701 [jlam 2004-08-06] Moved amavisd-new to security/amavisd-new [jlam 2004-08-06] Updated getmail to 4.0.8 [schmonz 2004-08-06] + Updated libnbcompat to 20040805 [jlam 2004-08-06] diff --git a/pkgtools/libnbcompat/Makefile b/pkgtools/libnbcompat/Makefile index f5ed5a6d1f5..cc5c8b8ed8f 100644 --- a/pkgtools/libnbcompat/Makefile +++ b/pkgtools/libnbcompat/Makefile @@ -1,21 +1,25 @@ -# $NetBSD: Makefile,v 1.35 2004/05/12 21:51:08 grant Exp $ +# $NetBSD: Makefile,v 1.36 2004/08/06 16:55:09 jlam Exp $ +# +# NOTE: If you update this package, it is *mandatory* that you update +# pkgsrc/pkgtools/libnbcompat/files/README to reflect the actual +# list of tested and supported platforms. # -DISTNAME= libnbcompat-20040512 +DISTNAME= libnbcompat-20040805 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty MAINTAINER= grant@NetBSD.org HOMEPAGE= http://www.NetBSD.org/ -COMMENT= Portable NetBSD compatibility library +COMMENT= portable NetBSD compatibility library -NO_BUILDLINK= # defined -NO_PKGTOOLS_REQD_CHECK= # defined -NO_CHECKSUM= # defined -NO_MTREE= # defined +NO_BUILDLINK= yes +NO_PKGTOOLS_REQD_CHECK= yes +NO_CHECKSUM= yes +NO_MTREE= yes -GNU_CONFIGURE= # defined +GNU_CONFIGURE= yes PKG_INFO= PKG_DBDIR=${_PKG_DBDIR} ${PKG_INFO_CMD} PKG_CREATE= PKG_DBDIR=${_PKG_DBDIR} ${PKG_CREATE_CMD} diff --git a/pkgtools/libnbcompat/PLIST b/pkgtools/libnbcompat/PLIST index 4ad1e9fbe62..d9c09142606 100644 --- a/pkgtools/libnbcompat/PLIST +++ b/pkgtools/libnbcompat/PLIST @@ -1,6 +1,7 @@ -@comment $NetBSD: PLIST,v 1.10 2003/09/06 01:35:07 jlam Exp $ +@comment $NetBSD: PLIST,v 1.11 2004/08/06 16:55:09 jlam Exp $ include/nbcompat.h include/nbcompat/err.h +include/nbcompat/fnmatch.h include/nbcompat/fts.h include/nbcompat/getopt.h include/nbcompat/glob.h @@ -8,9 +9,10 @@ include/nbcompat/md5.h include/nbcompat/nbconfig.h include/nbcompat/nbtypes.h include/nbcompat/poll.h +include/nbcompat/queue.h include/nbcompat/rmd160.h include/nbcompat/sha1.h -include/nbcompat/statfs.h +include/nbcompat/statvfs.h include/nbcompat/vis.h lib/libnbcompat.a @dirrm include/nbcompat diff --git a/pkgtools/libnbcompat/buildlink3.mk b/pkgtools/libnbcompat/buildlink3.mk index 1bb96ac041d..1e06a44c5f5 100644 --- a/pkgtools/libnbcompat/buildlink3.mk +++ b/pkgtools/libnbcompat/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.6 2004/03/05 19:25:39 jlam Exp $ +# $NetBSD: buildlink3.mk,v 1.7 2004/08/06 16:55:09 jlam Exp $ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ LIBNBCOMPAT_BUILDLINK3_MK:= ${LIBNBCOMPAT_BUILDLINK3_MK}+ @@ -11,7 +11,7 @@ BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nlibnbcompat} BUILDLINK_PACKAGES+= libnbcompat .if !empty(LIBNBCOMPAT_BUILDLINK3_MK:M+) -BUILDLINK_DEPENDS.libnbcompat+= libnbcompat>=20030916 +BUILDLINK_DEPENDS.libnbcompat+= libnbcompat>=20040805 BUILDLINK_PKGSRCDIR.libnbcompat?= ../../pkgtools/libnbcompat BUILDLINK_DEPMETHOD.libnbcompat?= build BUILDLINK_LDADD.libnbcompat= -lnbcompat diff --git a/pkgtools/libnbcompat/files/Makefile.in b/pkgtools/libnbcompat/files/Makefile.in index 75d4208ec5d..588fc042748 100644 --- a/pkgtools/libnbcompat/files/Makefile.in +++ b/pkgtools/libnbcompat/files/Makefile.in @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.in,v 1.22 2003/12/10 07:21:20 grant Exp $ +# $NetBSD: Makefile.in,v 1.23 2004/08/06 16:55:09 jlam Exp $ # srcdir= @srcdir@ @@ -19,10 +19,11 @@ RANLIB= @RANLIB@ LIB= libnbcompat.a -INCS= nbcompat.h nbcompat/err.h nbcompat/fts.h nbcompat/getopt.h \ - nbcompat/glob.h nbcompat/md5.h nbcompat/nbconfig.h \ - nbcompat/nbtypes.h nbcompat/poll.h nbcompat/rmd160.h \ - nbcompat/sha1.h nbcompat/statfs.h nbcompat/vis.h +INCS= nbcompat.h nbcompat/err.h nbcompat/fnmatch.h nbcompat/fts.h \ + nbcompat/getopt.h nbcompat/glob.h nbcompat/md5.h \ + nbcompat/nbconfig.h nbcompat/nbtypes.h nbcompat/poll.h \ + nbcompat/queue.h nbcompat/rmd160.h nbcompat/sha1.h \ + nbcompat/statvfs.h nbcompat/vis.h # always use our local glob() implementation. OBJS= glob.o @LIBOBJS@ diff --git a/pkgtools/libnbcompat/files/README b/pkgtools/libnbcompat/files/README new file mode 100644 index 00000000000..856449b47b9 --- /dev/null +++ b/pkgtools/libnbcompat/files/README @@ -0,0 +1,85 @@ +$NetBSD: README,v 1.1 2004/08/06 16:55:09 jlam Exp $ + + 0 Introduction + ============== + +libnbcompat builds and installs a portable NetBSD-compability library +that supplies routines missing on operating systems that are used by +the family of pkgsrc bootstrap tools. Note that libnbcompat is very +much a work-in-progress. Only the functions that are directly used +by the bootstrap tools are implemented in the library. At the moment, +this includes the following packages: + + archivers/pax + pkgtools/mtree + pkgtools/pkg_install + +A script, src2nbcompat is also included in the sources that simplifies +importing software from the NetBSD src module into pkgsrc. + + + 1 Updating this package + ======================= + +Please take care when updating this package. Do *not* simply commit +changes to this package and ask for testers. This package is too +fundamental to the proper bootstrapping of pkgsrc to let accidental +breakage seep in. Proper methodology for updating this package is: + + (1) Post a tarball at a publicly accessible URL containing the + pkgtools/libnbcompat directory. + + (2) Ask on the tech-pkg@NetBSD.org mailing list for testers. + + (3) Fix any breakage on non-NetBSD operating systems before + committing. + + + 2 Tested operating systems + ========================== + +*NOTE* +*NOTE* This section should be kept up-to-date with the results for +*NOTE* the most recent libnbcompat. +*NOTE* + +libnbcompat-20040805 has been tested to build and install correctly +on the following operating systems: + + FreeBSD-4.8/i386 <jlam@NetBSD.org> + IRIX 6.5 <jschauma@NetBSD.org> + MacOS X 10.3.4 <schmonz@NetBSD.org> + NetBSD-1.6.2/i386 <jlam@NetBSD.org> + NetBSD-2.0_BETA/i386 <hubertf@NetBSD.org> + Red Hat Linux 7.3 <schmonz@NetBSD.org> + Solaris 9/sparc <salo@NetBSD.org> + + + 3 Usage + ======= + +This library is intended to simplify porting NetBSD software. To that +end, the changes to NetBSD sources to use libnbcompat are minor. The +procedure is: + + (1) Add #include <nbcompat.h> at the top of the source file. + + (2) Surround each system header file included in the source file + with #if HAVE_<header_name>_H ... #endif. + +You may need to add additional headers present on other operating +systems that define any system-supplied functions, e.g. <sys/vfs.h>. + +The src2nbcompat script included in the libncompat sources can be used +to automate this process to some extent. It is intended to import +sources from a NetBSD src checkout into pkgsrc. It will copy the +sources from a directory and automatically insert the proper lines +into the files. For example, to import the pkg_install sources into +pkgsrc, run: + + src2nbcompat \ + /usr/src/usr.sbin/pkg_install \ + /usr/pkgsrc/pkgtools/pkg_install/files + +You will need to run a "cvs diff" on the imported files to check that +any local changes are preserved across imports. diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure index 8561005c190..479d707db94 100755 --- a/pkgtools/libnbcompat/files/configure +++ b/pkgtools/libnbcompat/files/configure @@ -3296,15 +3296,16 @@ done for ac_header in arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \ - errno.h fcntl.h fts.h inttypes.h libutil.h limits.h \ + errno.h fcntl.h fnmatch.h fts.h inttypes.h libutil.h limits.h \ machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \ paths.h pwd.h stdint.h stdlib.h stringlist.h strings.h \ string.h sys/bitypes.h sys/byteorder.h sys/cdefs.h sys/dir.h \ sys/endian.h sys/file.h sys/mkdev.h sys/ndir.h \ - sys/param.h sys/queue.h sys/time.h sys/ttycom.h \ + sys/param.h sys/time.h sys/ttycom.h \ sys/stat.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/types.h \ sys/vfs.h termcap.h termios.h time.h tzfile.h unistd.h util.h \ utmp.h + do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -3468,10 +3469,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#ifdef HAVE_SYS_PARAM_H -#include <sys/param.h> -#endif + + $ac_includes_default + #ifdef HAVE_SYS_PARAM_H + #include <sys/param.h> + #endif #include <$ac_header> @@ -3513,16 +3515,173 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF + : +else + : +fi + +done + + + +for ac_header in glob.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------- ## +## Report this to grant@NetBSD.org ## +## ------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi done +cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_GLOB 1 +_ACEOF -for ac_header in md5.h rmd160.h sha1.h + +for ac_header in sys/queue.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -3671,8 +3830,13 @@ fi done +cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_QUEUE 1 +_ACEOF + + + -pkg_use_nbcompat_md5=yes for ac_header in md5.h do @@ -3832,12 +3996,17 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include <sys/types.h> - #include <md5.h> + + #include <sys/types.h> + #include <md5.h> + int main () { - MD5_CTX *f; MD5Init(f); ; + + MD5_CTX *f; + MD5Init(f); + ; ; return 0; } @@ -3877,9 +4046,16 @@ fi echo "$as_me:$LINENO: result: $pkg_cv_have_md5init" >&5 echo "${ECHO_T}$pkg_cv_have_md5init" >&6 if test "x$pkg_cv_have_md5init" = "xyes"; then - pkg_use_nbcompat_md5=no + : else - pkg_use_nbcompat_md5=yes + + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_MD5INIT 1 +_ACEOF + + + + : fi @@ -3889,16 +4065,516 @@ fi done -if test $pkg_use_nbcompat_md5 = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_NBCOMPAT_MD5INIT 1 + + + +for ac_header in md5.h rmd160.h sha1.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------- ## +## Report this to grant@NetBSD.org ## +## ------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for MD5File" >&5 +echo $ECHO_N "checking for MD5File... $ECHO_C" >&6 +if test "${ac_cv_func_MD5File+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define MD5File to an innocuous variant, in case <limits.h> declares MD5File. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define MD5File innocuous_MD5File + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char MD5File (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef MD5File + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char MD5File (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_MD5File) || defined (__stub___MD5File) +choke me +#else +char (*f) () = MD5File; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != MD5File; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_MD5File=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_MD5File=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_MD5File" >&5 +echo "${ECHO_T}$ac_cv_func_MD5File" >&6 +if test $ac_cv_func_MD5File = yes; then + : +else + + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_MD5 1 +_ACEOF + + + + case $LIBOBJS in + "md5c.$ac_objext" | \ + *" md5c.$ac_objext" | \ + "md5c.$ac_objext "* | \ + *" md5c.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS md5c.$ac_objext" ;; +esac + + case $LIBOBJS in + "md5hl.$ac_objext" | \ + *" md5hl.$ac_objext" | \ + "md5hl.$ac_objext "* | \ + *" md5hl.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS md5hl.$ac_objext" ;; +esac + + +fi + +echo "$as_me:$LINENO: checking for RMD160File" >&5 +echo $ECHO_N "checking for RMD160File... $ECHO_C" >&6 +if test "${ac_cv_func_RMD160File+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define RMD160File to an innocuous variant, in case <limits.h> declares RMD160File. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define RMD160File innocuous_RMD160File + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char RMD160File (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef RMD160File + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char RMD160File (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_RMD160File) || defined (__stub___RMD160File) +choke me +#else +char (*f) () = RMD160File; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != RMD160File; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_RMD160File=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_RMD160File=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_RMD160File" >&5 +echo "${ECHO_T}$ac_cv_func_RMD160File" >&6 +if test $ac_cv_func_RMD160File = yes; then + : +else + + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_RMD160 1 +_ACEOF + + + + case $LIBOBJS in + "rmd160.$ac_objext" | \ + *" rmd160.$ac_objext" | \ + "rmd160.$ac_objext "* | \ + *" rmd160.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS rmd160.$ac_objext" ;; +esac + + case $LIBOBJS in + "rmd160hl.$ac_objext" | \ + *" rmd160hl.$ac_objext" | \ + "rmd160hl.$ac_objext "* | \ + *" rmd160hl.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS rmd160hl.$ac_objext" ;; +esac + + +fi + +echo "$as_me:$LINENO: checking for SHA1File" >&5 +echo $ECHO_N "checking for SHA1File... $ECHO_C" >&6 +if test "${ac_cv_func_SHA1File+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define SHA1File to an innocuous variant, in case <limits.h> declares SHA1File. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define SHA1File innocuous_SHA1File + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char SHA1File (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef SHA1File + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SHA1File (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_SHA1File) || defined (__stub___SHA1File) +choke me +#else +char (*f) () = SHA1File; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != SHA1File; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_SHA1File=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_SHA1File=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_SHA1File" >&5 +echo "${ECHO_T}$ac_cv_func_SHA1File" >&6 +if test $ac_cv_func_SHA1File = yes; then + : +else + + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_SHA1 1 _ACEOF + case $LIBOBJS in + "sha1.$ac_objext" | \ + *" sha1.$ac_objext" | \ + "sha1.$ac_objext "* | \ + *" sha1.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS sha1.$ac_objext" ;; +esac + + case $LIBOBJS in + "sha1hl.$ac_objext" | \ + *" sha1hl.$ac_objext" | \ + "sha1hl.$ac_objext "* | \ + *" sha1hl.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS sha1hl.$ac_objext" ;; +esac + + fi -pkg_use_nbcompat_getopt_long=yes + for ac_header in getopt.h do @@ -4062,7 +4738,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - struct option X ; + struct option X; ; ; return 0; } @@ -4102,25 +4778,16 @@ fi echo "$as_me:$LINENO: result: $pkg_cv_have_struct_option" >&5 echo "${ECHO_T}$pkg_cv_have_struct_option" >&6 if test "x$pkg_cv_have_struct_option" = "xyes"; then - pkg_use_nbcompat_getopt_long=no - else - pkg_use_nbcompat_getopt_long=yes : - fi - - -fi - -done + else -if test $pkg_use_nbcompat_getopt_long = yes; then - cat >>confdefs.h <<\_ACEOF + cat >>confdefs.h <<\_ACEOF #define HAVE_NBCOMPAT_GETOPT_LONG 1 _ACEOF - case $LIBOBJS in + case $LIBOBJS in "getopt_long.$ac_objext" | \ *" getopt_long.$ac_objext" | \ "getopt_long.$ac_objext "* | \ @@ -4128,9 +4795,16 @@ _ACEOF *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext" ;; esac + + : + fi + + fi -pkg_use_nbcompat_vis=yes +done + + for ac_header in vis.h do @@ -4290,12 +4964,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include <sys/types.h> - #include <vis.h> + + #include <sys/types.h> + #include <vis.h> + int main () { - int X = VIS_WHITE ; + int X = VIS_WHITE; ; ; return 0; } @@ -4335,9 +5011,220 @@ fi echo "$as_me:$LINENO: result: $pkg_cv_have_vis_white" >&5 echo "${ECHO_T}$pkg_cv_have_vis_white" >&6 if test "x$pkg_cv_have_vis_white" = "xyes"; then - pkg_use_nbcompat_vis=no + + + + +for ac_func in strunvis strvis strsvis +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + +for ac_func in strunvis strvis strsvis +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + pkg_use_nbcompat_vis=no +else + pkg_use_nbcompat_vis=yes; break +fi +done + + else - pkg_use_nbcompat_vis=yes + pkg_use_nbcompat_vis=yes : fi @@ -4347,6 +5234,31 @@ fi done +if test $pkg_use_nbcompat_vis = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_VIS 1 +_ACEOF + + + + case $LIBOBJS in + "vis.$ac_objext" | \ + *" vis.$ac_objext" | \ + "vis.$ac_objext "* | \ + *" vis.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vis.$ac_objext" ;; +esac + + case $LIBOBJS in + "unvis.$ac_objext" | \ + *" unvis.$ac_objext" | \ + "unvis.$ac_objext "* | \ + *" unvis.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS unvis.$ac_objext" ;; +esac + +fi + echo "$as_me:$LINENO: checking for __attribute__" >&5 echo $ECHO_N "checking for __attribute__... $ECHO_C" >&6 @@ -6959,14 +7871,11 @@ done - - - - -for ac_func in err fgetln fparseln fseeko getenv inet_ntop \ - inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \ +for ac_func in err fgetln fnmatch fparseln getenv \ + isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \ setprogname snprintf strdup strerror strlcat strlcpy \ - strmode strptime strsep strtoll timegm usleep utimes + strmode strsep strtoll usleep utimes + do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -7491,13 +8400,22 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - pkg_use_nbcompat_setmode=no + : else - pkg_use_nbcompat_setmode=yes; break + + case $LIBOBJS in + "setmode.$ac_objext" | \ + *" setmode.$ac_objext" | \ + "setmode.$ac_objext "* | \ + *" setmode.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS setmode.$ac_objext" ;; +esac + + break + fi done -pkg_use_nbcompat_setenv=no for ac_func in setenv unsetenv @@ -7598,41 +8516,12 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -else - pkg_use_nbcompat_setenv=yes fi done -if test $pkg_use_nbcompat_setmode = yes; then - case $LIBOBJS in - "setmode.$ac_objext" | \ - *" setmode.$ac_objext" | \ - "setmode.$ac_objext "* | \ - *" setmode.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS setmode.$ac_objext" ;; -esac -fi -if test $pkg_use_nbcompat_setenv = yes; then - case $LIBOBJS in - "setenv.$ac_objext" | \ - *" setenv.$ac_objext" | \ - "setenv.$ac_objext "* | \ - *" setenv.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS setenv.$ac_objext" ;; -esac - -fi - - - - - - - -for ac_func in gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \ - uid_from_user user_from_uid +for ac_func in setenv unsetenv do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -7729,6 +8618,18 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF + : +else + + case $LIBOBJS in + "setenv.$ac_objext" | \ + *" setenv.$ac_objext" | \ + "setenv.$ac_objext "* | \ + *" setenv.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS setenv.$ac_objext" ;; +esac + + break fi done @@ -7739,8 +8640,10 @@ done -for ac_func in gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \ - uid_from_user user_from_uid + +for ac_func in gid_from_group group_from_gid pwcache_groupdb \ + pwcache_userdb uid_from_user user_from_uid \ + do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -7837,131 +8740,24 @@ if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - pkg_use_nbcompat_pwcache=no -else - pkg_use_nbcompat_pwcache=yes; break + fi done -if test $pkg_use_nbcompat_pwcache = yes; then - case $LIBOBJS in - "pwcache.$ac_objext" | \ - *" pwcache.$ac_objext" | \ - "pwcache.$ac_objext "* | \ - *" pwcache.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS pwcache.$ac_objext" ;; -esac -fi -echo "$as_me:$LINENO: checking for fts_open" >&5 -echo $ECHO_N "checking for fts_open... $ECHO_C" >&6 -if test "${ac_cv_func_fts_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define fts_open to an innocuous variant, in case <limits.h> declares fts_open. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define fts_open innocuous_fts_open -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char fts_open (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef fts_open - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char fts_open (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_fts_open) || defined (__stub___fts_open) -choke me -#else -char (*f) () = fts_open; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != fts_open; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fts_open=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_fts_open=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_fts_open" >&5 -echo "${ECHO_T}$ac_cv_func_fts_open" >&6 -if test $ac_cv_func_fts_open = yes; then - : -else - case $LIBOBJS in - "__fts13.$ac_objext" | \ - *" __fts13.$ac_objext" | \ - "__fts13.$ac_objext "* | \ - *" __fts13.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS __fts13.$ac_objext" ;; -esac -fi +for ac_func in gid_from_group group_from_gid pwcache_groupdb \ + pwcache_userdb uid_from_user user_from_uid \ -echo "$as_me:$LINENO: checking for MD5File" >&5 -echo $ECHO_N "checking for MD5File... $ECHO_C" >&6 -if test "${ac_cv_func_MD5File+set}" = set; then +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7970,12 +8766,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define MD5File to an innocuous variant, in case <limits.h> declares MD5File. +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define MD5File innocuous_MD5File +#define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char MD5File (); below. + which can conflict with char $ac_func (); below. Prefer <limits.h> to <assert.h> if __STDC__ is defined, since <limits.h> exists even on freestanding compilers. */ @@ -7985,7 +8781,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include <assert.h> #endif -#undef MD5File +#undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -7994,14 +8790,14 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char MD5File (); +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_MD5File) || defined (__stub___MD5File) +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -char (*f) () = MD5File; +char (*f) () = $ac_func; #endif #ifdef __cplusplus } @@ -8010,7 +8806,7 @@ char (*f) () = MD5File; int main () { -return f != MD5File; +return f != $ac_func; ; return 0; } @@ -8037,44 +8833,42 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_MD5File=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_MD5File=no +eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_MD5File" >&5 -echo "${ECHO_T}$ac_cv_func_MD5File" >&6 -if test $ac_cv_func_MD5File = yes; then - : +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + : else case $LIBOBJS in - "md5c.$ac_objext" | \ - *" md5c.$ac_objext" | \ - "md5c.$ac_objext "* | \ - *" md5c.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS md5c.$ac_objext" ;; -esac - - case $LIBOBJS in - "md5hl.$ac_objext" | \ - *" md5hl.$ac_objext" | \ - "md5hl.$ac_objext "* | \ - *" md5hl.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS md5hl.$ac_objext" ;; + "pwcache.$ac_objext" | \ + *" pwcache.$ac_objext" | \ + "pwcache.$ac_objext "* | \ + *" pwcache.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS pwcache.$ac_objext" ;; esac + break fi +done -echo "$as_me:$LINENO: checking for RMD160File" >&5 -echo $ECHO_N "checking for RMD160File... $ECHO_C" >&6 -if test "${ac_cv_func_RMD160File+set}" = set; then + +echo "$as_me:$LINENO: checking for fts_open" >&5 +echo $ECHO_N "checking for fts_open... $ECHO_C" >&6 +if test "${ac_cv_func_fts_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8083,12 +8877,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define RMD160File to an innocuous variant, in case <limits.h> declares RMD160File. +/* Define fts_open to an innocuous variant, in case <limits.h> declares fts_open. For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define RMD160File innocuous_RMD160File +#define fts_open innocuous_fts_open /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char RMD160File (); below. + which can conflict with char fts_open (); below. Prefer <limits.h> to <assert.h> if __STDC__ is defined, since <limits.h> exists even on freestanding compilers. */ @@ -8098,7 +8892,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include <assert.h> #endif -#undef RMD160File +#undef fts_open /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -8107,14 +8901,14 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char RMD160File (); +char fts_open (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_RMD160File) || defined (__stub___RMD160File) +#if defined (__stub_fts_open) || defined (__stub___fts_open) choke me #else -char (*f) () = RMD160File; +char (*f) () = fts_open; #endif #ifdef __cplusplus } @@ -8123,7 +8917,7 @@ char (*f) () = RMD160File; int main () { -return f != RMD160File; +return f != fts_open; ; return 0; } @@ -8150,149 +8944,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_RMD160File=yes + ac_cv_func_fts_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_RMD160File=no +ac_cv_func_fts_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_RMD160File" >&5 -echo "${ECHO_T}$ac_cv_func_RMD160File" >&6 -if test $ac_cv_func_RMD160File = yes; then +echo "$as_me:$LINENO: result: $ac_cv_func_fts_open" >&5 +echo "${ECHO_T}$ac_cv_func_fts_open" >&6 +if test $ac_cv_func_fts_open = yes; then : else - case $LIBOBJS in - "rmd160.$ac_objext" | \ - *" rmd160.$ac_objext" | \ - "rmd160.$ac_objext "* | \ - *" rmd160.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS rmd160.$ac_objext" ;; -esac - - case $LIBOBJS in - "rmd160hl.$ac_objext" | \ - *" rmd160hl.$ac_objext" | \ - "rmd160hl.$ac_objext "* | \ - *" rmd160hl.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS rmd160hl.$ac_objext" ;; -esac - - -fi - -echo "$as_me:$LINENO: checking for SHA1File" >&5 -echo $ECHO_N "checking for SHA1File... $ECHO_C" >&6 -if test "${ac_cv_func_SHA1File+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define SHA1File to an innocuous variant, in case <limits.h> declares SHA1File. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define SHA1File innocuous_SHA1File - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char SHA1File (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef SHA1File - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char SHA1File (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_SHA1File) || defined (__stub___SHA1File) -choke me -#else -char (*f) () = SHA1File; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != SHA1File; - ; - return 0; -} + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_FTS 1 _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_SHA1File=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_SHA1File=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_SHA1File" >&5 -echo "${ECHO_T}$ac_cv_func_SHA1File" >&6 -if test $ac_cv_func_SHA1File = yes; then - : -else - case $LIBOBJS in - "sha1.$ac_objext" | \ - *" sha1.$ac_objext" | \ - "sha1.$ac_objext "* | \ - *" sha1.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS sha1.$ac_objext" ;; -esac case $LIBOBJS in - "sha1hl.$ac_objext" | \ - *" sha1hl.$ac_objext" | \ - "sha1hl.$ac_objext "* | \ - *" sha1hl.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS sha1hl.$ac_objext" ;; + "__fts13.$ac_objext" | \ + *" __fts13.$ac_objext" | \ + "__fts13.$ac_objext "* | \ + *" __fts13.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS __fts13.$ac_objext" ;; esac @@ -8658,242 +9337,6 @@ fi -for ac_func in strunvis strvis strsvis -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - -for ac_func in strunvis strvis strsvis -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - pkg_use_nbcompat_vis=no -else - pkg_use_nbcompat_vis=yes; break -fi -done - - -if test $pkg_use_nbcompat_vis = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_NBCOMPAT_VIS 1 -_ACEOF - - - - case $LIBOBJS in - "vis.$ac_objext" | \ - *" vis.$ac_objext" | \ - "vis.$ac_objext "* | \ - *" vis.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS vis.$ac_objext" ;; -esac - - case $LIBOBJS in - "unvis.$ac_objext" | \ - *" unvis.$ac_objext" | \ - "unvis.$ac_objext "* | \ - *" unvis.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS unvis.$ac_objext" ;; -esac - -fi - - - - for ac_func in getpassphrase getpgrp memmove select do @@ -9154,9 +9597,9 @@ fi fi -echo "$as_me:$LINENO: checking for sl_init" >&5 -echo $ECHO_N "checking for sl_init... $ECHO_C" >&6 -if test "${ac_cv_func_sl_init+set}" = set; then +echo "$as_me:$LINENO: checking for statvfs" >&5 +echo $ECHO_N "checking for statvfs... $ECHO_C" >&6 +if test "${ac_cv_func_statvfs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9165,12 +9608,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define sl_init to an innocuous variant, in case <limits.h> declares sl_init. +/* Define statvfs to an innocuous variant, in case <limits.h> declares statvfs. For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define sl_init innocuous_sl_init +#define statvfs innocuous_statvfs /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char sl_init (); below. + which can conflict with char statvfs (); below. Prefer <limits.h> to <assert.h> if __STDC__ is defined, since <limits.h> exists even on freestanding compilers. */ @@ -9180,7 +9623,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include <assert.h> #endif -#undef sl_init +#undef statvfs /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -9189,14 +9632,14 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char sl_init (); +char statvfs (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_sl_init) || defined (__stub___sl_init) +#if defined (__stub_statvfs) || defined (__stub___statvfs) choke me #else -char (*f) () = sl_init; +char (*f) () = statvfs; #endif #ifdef __cplusplus } @@ -9205,7 +9648,7 @@ char (*f) () = sl_init; int main () { -return f != sl_init; +return f != statvfs; ; return 0; } @@ -9232,98 +9675,39 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_sl_init=yes + ac_cv_func_statvfs=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_sl_init=no +ac_cv_func_statvfs=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_sl_init" >&5 -echo "${ECHO_T}$ac_cv_func_sl_init" >&6 -if test $ac_cv_func_sl_init = yes; then - - - echo "$as_me:$LINENO: checking if sl_add() returns int" >&5 -echo $ECHO_N "checking if sl_add() returns int... $ECHO_C" >&6 -if test "${pkg_cv_INT_SL_ADD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $ac_cv_func_statvfs" >&5 +echo "${ECHO_T}$ac_cv_func_statvfs" >&6 +if test $ac_cv_func_statvfs = yes; then + : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - #include <stringlist.h> -int -main () -{ - int f = sl_add((StringList *)0, "foo") ; - ; - return 0; -} + cat >>confdefs.h <<\_ACEOF +#define HAVE_NBCOMPAT_STATVFS 1 _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - pkg_cv_INT_SL_ADD=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - pkg_cv_INT_SL_ADD=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $pkg_cv_INT_SL_ADD" >&5 -echo "${ECHO_T}$pkg_cv_INT_SL_ADD" >&6 - if test "x$pkg_cv_INT_SL_ADD" = "xyes"; then - : - else - case $LIBOBJS in - "sl_init.$ac_objext" | \ - *" sl_init.$ac_objext" | \ - "sl_init.$ac_objext "* | \ - *" sl_init.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS sl_init.$ac_objext" ;; -esac - : - fi -fi - + case $LIBOBJS in + "statvfs.$ac_objext" | \ + *" statvfs.$ac_objext" | \ + "statvfs.$ac_objext "* | \ + *" statvfs.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS statvfs.$ac_objext" ;; +esac -pkg_use_nbcompat_statfs=yes -echo "$as_me:$LINENO: checking for statfs" >&5 -echo $ECHO_N "checking for statfs... $ECHO_C" >&6 -if test "${ac_cv_func_statfs+set}" = set; then + echo "$as_me:$LINENO: checking for struct statfs.f_fsize" >&5 +echo $ECHO_N "checking for struct statfs.f_fsize... $ECHO_C" >&6 +if test "${ac_cv_member_struct_statfs_f_fsize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9332,54 +9716,21 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define statfs to an innocuous variant, in case <limits.h> declares statfs. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define statfs innocuous_statfs - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char statfs (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef statfs - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char statfs (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_statfs) || defined (__stub___statfs) -choke me -#else -char (*f) () = statfs; -#endif -#ifdef __cplusplus -} -#endif + #include <sys/statfs.h> int main () { -return f != statfs; +static struct statfs ac_aggr; +if (ac_aggr.f_fsize) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -9393,87 +9744,38 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_statfs=yes + ac_cv_member_struct_statfs_f_fsize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_statfs=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_statfs" >&5 -echo "${ECHO_T}$ac_cv_func_statfs" >&6 -if test $ac_cv_func_statfs = yes; then - - case $host_os in - irix*|sunos*|solaris*|*UnixWare*) - echo "$as_me:$LINENO: checking for statvfs" >&5 -echo $ECHO_N "checking for statvfs... $ECHO_C" >&6 -if test "${ac_cv_func_statvfs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define statvfs to an innocuous variant, in case <limits.h> declares statvfs. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define statvfs innocuous_statvfs - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char statvfs (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef statvfs - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char statvfs (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_statvfs) || defined (__stub___statvfs) -choke me -#else -char (*f) () = statvfs; -#endif -#ifdef __cplusplus -} -#endif + #include <sys/statfs.h> int main () { -return f != statvfs; +static struct statfs ac_aggr; +if (sizeof ac_aggr.f_fsize) +return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -9487,61 +9789,39 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_statvfs=yes + ac_cv_member_struct_statfs_f_fsize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_statvfs=no +ac_cv_member_struct_statfs_f_fsize=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_statvfs" >&5 -echo "${ECHO_T}$ac_cv_func_statvfs" >&6 -if test $ac_cv_func_statvfs = yes; then - : -else - - { { echo "$as_me:$LINENO: error: statfs can't be implemented correctly" >&5 -echo "$as_me: error: statfs can't be implemented correctly" >&2;} - { (exit 1); exit 1; }; } - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - - ;; - *) - pkg_use_nbcompat_statfs=no - ;; - esac - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_fsize" >&5 +echo "${ECHO_T}$ac_cv_member_struct_statfs_f_fsize" >&6 +if test $ac_cv_member_struct_statfs_f_fsize = yes; then - -if test $pkg_use_nbcompat_statfs = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_NBCOMPAT_STATFS 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATFS_F_FSIZE 1 _ACEOF +: +else + : +fi - - case $LIBOBJS in - "statfs.$ac_objext" | \ - *" statfs.$ac_objext" | \ - "statfs.$ac_objext "* | \ - *" statfs.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS statfs.$ac_objext" ;; -esac - - echo "$as_me:$LINENO: checking for struct statvfs.f_basetype" >&5 -echo $ECHO_N "checking for struct statvfs.f_basetype... $ECHO_C" >&6 -if test "${ac_cv_member_struct_statvfs_f_basetype+set}" = set; then + echo "$as_me:$LINENO: checking for struct statfs.f_iosize" >&5 +echo $ECHO_N "checking for struct statfs.f_iosize... $ECHO_C" >&6 +if test "${ac_cv_member_struct_statfs_f_iosize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9550,13 +9830,13 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/statvfs.h> + #include <sys/statfs.h> int main () { -static struct statvfs ac_aggr; -if (ac_aggr.f_basetype) +static struct statfs ac_aggr; +if (ac_aggr.f_iosize) return 0; ; return 0; @@ -9584,7 +9864,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_statvfs_f_basetype=yes + ac_cv_member_struct_statfs_f_iosize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -9595,13 +9875,13 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <sys/statvfs.h> + #include <sys/statfs.h> int main () { -static struct statvfs ac_aggr; -if (sizeof ac_aggr.f_basetype) +static struct statfs ac_aggr; +if (sizeof ac_aggr.f_iosize) return 0; ; return 0; @@ -9629,30 +9909,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_member_struct_statvfs_f_basetype=yes + ac_cv_member_struct_statfs_f_iosize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_statvfs_f_basetype=no +ac_cv_member_struct_statfs_f_iosize=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_statvfs_f_basetype" >&5 -echo "${ECHO_T}$ac_cv_member_struct_statvfs_f_basetype" >&6 -if test $ac_cv_member_struct_statvfs_f_basetype = yes; then +echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_iosize" >&5 +echo "${ECHO_T}$ac_cv_member_struct_statfs_f_iosize" >&6 +if test $ac_cv_member_struct_statfs_f_iosize = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STATVFS_F_BASETYPE 1 +#define HAVE_STRUCT_STATFS_F_IOSIZE 1 _ACEOF - +: +else + : fi + fi + if test $ac_cv_type_long_long = yes; then @@ -9660,7 +9944,7 @@ if test $ac_cv_type_long_long = yes; then echo $ECHO_N "checking *printf() support for %lld... $ECHO_C" >&6 can_printf_longlong=no if test "$cross_compiling" = yes; then - : + : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -9711,7 +9995,7 @@ fi echo "$as_me:$LINENO: checking *printf() support for %qd" >&5 echo $ECHO_N "checking *printf() support for %qd... $ECHO_C" >&6 if test "$cross_compiling" = yes; then - : + : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac index cf48d4bbafb..3edb5c257bd 100644 --- a/pkgtools/libnbcompat/files/configure.ac +++ b/pkgtools/libnbcompat/files/configure.ac @@ -1,4 +1,4 @@ -dnl $NetBSD: configure.ac,v 1.43 2004/04/23 11:42:46 grant Exp $ +dnl $NetBSD: configure.ac,v 1.44 2004/08/06 16:55:09 jlam Exp $ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) @@ -33,70 +33,120 @@ AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS([arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \ - errno.h fcntl.h fts.h inttypes.h libutil.h limits.h \ + errno.h fcntl.h fnmatch.h fts.h inttypes.h libutil.h limits.h \ machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \ paths.h pwd.h stdint.h stdlib.h stringlist.h strings.h \ string.h sys/bitypes.h sys/byteorder.h sys/cdefs.h sys/dir.h \ sys/endian.h sys/file.h sys/mkdev.h sys/ndir.h \ - sys/param.h sys/queue.h sys/time.h sys/ttycom.h \ + sys/param.h sys/time.h sys/ttycom.h \ sys/stat.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/types.h \ sys/vfs.h termcap.h termios.h time.h tzfile.h unistd.h util.h \ - utmp.h]) -AC_CHECK_HEADERS([sys/mount.h], , , [AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_PARAM_H -#include <sys/param.h> -#endif + utmp.h +]) +AC_CHECK_HEADERS([sys/mount.h], [:], [:], [ + AC_INCLUDES_DEFAULT + #ifdef HAVE_SYS_PARAM_H + #include <sys/param.h> + #endif ]) -AC_CHECK_HEADERS([md5.h rmd160.h sha1.h]) +dnl Always use our own glob(). +AC_CHECK_HEADERS([glob.h]) +AC_DEFINE(HAVE_NBCOMPAT_GLOB) +AH_TEMPLATE([HAVE_NBCOMPAT_GLOB], [ + Define to 1 if the `glob' function is built into the library. +]) + +dnl Always use our own queue(3) implementation. +AC_CHECK_HEADERS([sys/queue.h]) +AC_DEFINE(HAVE_NBCOMPAT_QUEUE) +AH_TEMPLATE([HAVE_NBCOMPAT_QUEUE], [ + Define to 1 if the `queue' macros are supplied by the library. +]) -pkg_use_nbcompat_md5=yes AC_CHECK_HEADERS([md5.h], [ - AC_MSG_TRY_COMPILE([for MD5Init in md5.h], pkg_cv_have_md5init, - [ #include <sys/types.h> - #include <md5.h> ], - [ MD5_CTX *f; MD5Init(f); ], - pkg_use_nbcompat_md5=no, - pkg_use_nbcompat_md5=yes, - ) + AC_MSG_TRY_COMPILE([for MD5Init in md5.h], pkg_cv_have_md5init, [ + #include <sys/types.h> + #include <md5.h> + ], [ + MD5_CTX *f; + MD5Init(f); + ], [:], [ + AC_DEFINE(HAVE_NBCOMPAT_MD5INIT) + AH_TEMPLATE([HAVE_NBCOMPAT_MD5INIT], [ + Define to 1 if the `MD5Init' function is built into + the library. + ]) + ]) ]) -if test $pkg_use_nbcompat_md5 = yes; then - AC_DEFINE(HAVE_NBCOMPAT_MD5INIT) - AH_TEMPLATE([HAVE_NBCOMPAT_MD5INIT], [ - Define to 1 if the `MD5Init' function is built into the +AC_CHECK_HEADERS([md5.h rmd160.h sha1.h]) +AC_CHECK_FUNC(MD5File, [:], [ + AC_DEFINE(HAVE_NBCOMPAT_MD5) + AH_TEMPLATE([HAVE_NBCOMPAT_MD5], [ + Define to 1 if the `MD5*' functions are built into the library. ]) -fi + AC_LIBOBJ(md5c) + AC_LIBOBJ(md5hl) +]) +AC_CHECK_FUNC(RMD160File, [:], [ + AC_DEFINE(HAVE_NBCOMPAT_RMD160) + AH_TEMPLATE([HAVE_NBCOMPAT_RMD160], [ + Define to 1 if the `RMD160*' functions are built into the + library. + ]) + AC_LIBOBJ(rmd160) + AC_LIBOBJ(rmd160hl) +]) +AC_CHECK_FUNC(SHA1File, [:], [ + AC_DEFINE(HAVE_NBCOMPAT_SHA1) + AH_TEMPLATE([HAVE_NBCOMPAT_SHA1], [ + Define to 1 if the `SHA1*' functions are built into the + library. + ]) + AC_LIBOBJ(sha1) + AC_LIBOBJ(sha1hl) +]) -pkg_use_nbcompat_getopt_long=yes AC_CHECK_HEADERS([getopt.h], [ AC_MSG_TRY_COMPILE([for struct option], pkg_cv_have_struct_option, - [ #include <getopt.h> ], [ struct option X ], - [ pkg_use_nbcompat_getopt_long=no ], - [ pkg_use_nbcompat_getopt_long=yes ]) + [ #include <getopt.h> ], [ struct option X; ], + [:], [ + AC_DEFINE(HAVE_NBCOMPAT_GETOPT_LONG) + AH_TEMPLATE([HAVE_NBCOMPAT_GETOPT_LONG], [ + Define to 1 if the `getopt_long' function is + built into the library. + ]) + AC_LIBOBJ(getopt_long) + ]) ]) -if test $pkg_use_nbcompat_getopt_long = yes; then - AC_DEFINE(HAVE_NBCOMPAT_GETOPT_LONG) - AH_TEMPLATE([HAVE_NBCOMPAT_GETOPT_LONG], [ - Define to 1 if the `getopt_long' function is built into the - library. - ]) - AC_LIBOBJ(getopt_long) -fi dnl Check that this vis.h has *vis()-related functions because Solaris' dnl vis.h doesn't. Also, only consider the header found if it defines dnl all of the functions that we need. dnl -pkg_use_nbcompat_vis=yes AC_CHECK_HEADERS([vis.h], [ - AC_MSG_TRY_COMPILE([for VIS_WHITE in vis.h], pkg_cv_have_vis_white, - [ #include <sys/types.h> - #include <vis.h> ], [ int X = VIS_WHITE ], - [ pkg_use_nbcompat_vis=no], [ pkg_use_nbcompat_vis=yes ]) + AC_MSG_TRY_COMPILE([for VIS_WHITE in vis.h], pkg_cv_have_vis_white, [ + #include <sys/types.h> + #include <vis.h> + ], [ int X = VIS_WHITE; ], [ + AC_CHECK_FUNCS([strunvis strvis strsvis]) + AC_CHECK_FUNCS([strunvis strvis strsvis], + [pkg_use_nbcompat_vis=no], + [pkg_use_nbcompat_vis=yes; break]) + ], [pkg_use_nbcompat_vis=yes]) ]) +if test $pkg_use_nbcompat_vis = yes; then + AC_DEFINE(HAVE_NBCOMPAT_VIS) + AH_TEMPLATE([HAVE_NBCOMPAT_VIS], [ + Define to 1 if the `vis' function is built into the library. + ]) + AC_LIBOBJ(vis) + AC_LIBOBJ(unvis) +fi + dnl Checks for typedefs, structures, and compiler characteristics. AC_C___ATTRIBUTE__ AC_TYPE_SIZE_T @@ -135,52 +185,42 @@ AC_FUNC_MALLOC AC_FUNC_STRERROR_R AC_FUNC_VPRINTF -AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv inet_ntop \ - inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \ +AC_REPLACE_FUNCS([err fgetln fnmatch fparseln getenv \ + isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \ setprogname snprintf strdup strerror strlcat strlcpy \ - strmode strptime strsep strtoll timegm usleep utimes]) + strmode strsep strtoll usleep utimes +]) AC_CHECK_FUNCS([setgroupent setgrent setpassent setpwent]) AC_CHECK_FUNCS([bcopy bzero memset memcpy setlocale]) AC_CHECK_FUNCS([getmode setmode]) -AC_CHECK_FUNCS([getmode setmode], - [pkg_use_nbcompat_setmode=no], - [pkg_use_nbcompat_setmode=yes; break]) -pkg_use_nbcompat_setenv=no -AC_CHECK_FUNCS([setenv unsetenv], , - [pkg_use_nbcompat_setenv=yes]) - -if test $pkg_use_nbcompat_setmode = yes; then +AC_CHECK_FUNCS([getmode setmode], [:], [ AC_LIBOBJ(setmode) -fi -if test $pkg_use_nbcompat_setenv = yes; then + break +]) +AC_CHECK_FUNCS([setenv unsetenv]) +AC_CHECK_FUNCS([setenv unsetenv], [:], [ AC_LIBOBJ(setenv) -fi - -AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \ - uid_from_user user_from_uid]) -AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \ - uid_from_user user_from_uid], - [pkg_use_nbcompat_pwcache=no], - [pkg_use_nbcompat_pwcache=yes; break]) - -if test $pkg_use_nbcompat_pwcache = yes; then - AC_LIBOBJ(pwcache) -fi - -AC_CHECK_FUNC(fts_open, [:], [AC_LIBOBJ(__fts13)]) + break +]) -AC_CHECK_FUNC(MD5File, [:], [ - AC_LIBOBJ(md5c) - AC_LIBOBJ(md5hl) +AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb \ + pwcache_userdb uid_from_user user_from_uid \ ]) -AC_CHECK_FUNC(RMD160File, [:], [ - AC_LIBOBJ(rmd160) - AC_LIBOBJ(rmd160hl) +AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb \ + pwcache_userdb uid_from_user user_from_uid \ +], [:], [ + AC_LIBOBJ(pwcache) + break ]) -AC_CHECK_FUNC(SHA1File, [:], [ - AC_LIBOBJ(sha1) - AC_LIBOBJ(sha1hl) + +AC_CHECK_FUNC(fts_open, [:], [ + AC_DEFINE(HAVE_NBCOMPAT_FTS, 1) + AH_TEMPLATE([HAVE_NBCOMPAT_FTS], [ + Define to 1 if the `fts_*' functions are built into the + library. + ]) + AC_LIBOBJ(__fts13) ]) # handle Darwin 7 having a poll() compatibility function. be @@ -227,57 +267,21 @@ else ]) fi -AC_CHECK_FUNCS([strunvis strvis strsvis]) -AC_CHECK_FUNCS([strunvis strvis strsvis], - [pkg_use_nbcompat_vis=no], - [pkg_use_nbcompat_vis=yes; break]) - -if test $pkg_use_nbcompat_vis = yes; then - AC_DEFINE(HAVE_NBCOMPAT_VIS) - AH_TEMPLATE([HAVE_NBCOMPAT_VIS], [ - Define to 1 if the `vis' function is built into the library. - ]) - AC_LIBOBJ(vis) - AC_LIBOBJ(unvis) -fi - AC_CHECK_FUNCS([getpassphrase getpgrp memmove select]) AC_CHECK_FUNC(getpgrp, [AC_FUNC_GETPGRP]) -AC_CHECK_FUNC(sl_init, [ - AC_MSG_TRY_COMPILE([if sl_add() returns int], - pkg_cv_INT_SL_ADD, - [ #include <stringlist.h> ], - [ int f = sl_add((StringList *)0, "foo") ], - [:] , [AC_LIBOBJ(sl_init)]) -]) - -dnl Solaris 2.7, 2.8 and UnixWare 7 have statfs(2), but it is deprecated, -dnl and has a different interface from NetBSD's statfs. -dnl -pkg_use_nbcompat_statfs=yes -AC_CHECK_FUNC(statfs, [ - case $host_os in - irix*|sunos*|solaris*|*UnixWare*) - AC_CHECK_FUNC(statvfs, [:], [ - AC_MSG_ERROR(statfs can't be implemented correctly) - ]) - ;; - *) - pkg_use_nbcompat_statfs=no - ;; - esac -]) - -if test $pkg_use_nbcompat_statfs = yes; then - AC_DEFINE(HAVE_NBCOMPAT_STATFS, 1) - AH_TEMPLATE([HAVE_NBCOMPAT_STATFS], [ - Define to 1 if the `statfs' function is built into the library. +AC_CHECK_FUNC(statvfs, [:], [ + AC_DEFINE(HAVE_NBCOMPAT_STATVFS, 1) + AH_TEMPLATE([HAVE_NBCOMPAT_STATVFS], [ + Define to 1 if the `statvfs' function is built into the library. ]) - AC_LIBOBJ(statfs) - AC_CHECK_MEMBERS([struct statvfs.f_basetype],[],[],[#include <sys/statvfs.h>]) -fi + AC_LIBOBJ(statvfs) + AC_CHECK_MEMBERS([struct statfs.f_fsize], [:], [:], + [ #include <sys/statfs.h> ]) + AC_CHECK_MEMBERS([struct statfs.f_iosize], [:], [:], + [ #include <sys/statfs.h> ]) +]) if test $ac_cv_type_long_long = yes; then @@ -299,7 +303,7 @@ dnl support because we don't know how to display it. can_printf_longlong=yes ], [ AC_MSG_RESULT(no) - ], [ : ]) + ], [:]) if test $can_printf_longlong != yes; then AC_MSG_CHECKING(*printf() support for %qd) @@ -320,7 +324,7 @@ dnl support because we don't know how to display it. ]) ], [ AC_MSG_RESULT(no) - ], [ : ]) + ], [:]) fi if test $can_printf_longlong = yes; then @@ -334,7 +338,7 @@ dnl support because we don't know how to display it. fi -AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [ +AC_MSG_TRY_COMPILE([for optarg declaration], ftp_cv_HAVE_OPTARG_D, [ #include <stdlib.h> #include <unistd.h> ], [ char *X = optarg ], [:], [ @@ -344,7 +348,7 @@ AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [ ]) ]) -AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [ +AC_MSG_TRY_COMPILE([for optind declaration], ftp_cv_HAVE_OPTIND_D, [ #include <stdlib.h> #include <unistd.h> ], [ int X = optind ], [:] [ diff --git a/pkgtools/libnbcompat/files/fnmatch.c b/pkgtools/libnbcompat/files/fnmatch.c new file mode 100644 index 00000000000..272f3fc005a --- /dev/null +++ b/pkgtools/libnbcompat/files/fnmatch.c @@ -0,0 +1,211 @@ +/* $NetBSD: fnmatch.c,v 1.1 2004/08/06 16:55:09 jlam Exp $ */ + +/* + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Guido van Rossum. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_CONFIG_H +#include "nbcompat/nbconfig.h" +#endif + +#if HAVE_SYS_CDEFS_H +#include <sys/cdefs.h> +#endif + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; +#else +__RCSID("$NetBSD: fnmatch.c,v 1.1 2004/08/06 16:55:09 jlam Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + +/* + * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6. + * Compares a filename or pathname to a pattern. + */ + +#include "namespace.h" + +#include <assert.h> +#include <ctype.h> +#include "nbcompat/fnmatch.h" +#include <string.h> + +#define EOS '\0' + +#ifndef _DIAGASSERT +#define _DIAGASSERT(cond) assert(cond) +#endif + +static const char *rangematch(const char *, int, int); + +static int +foldcase(int ch, int flags) +{ + + if ((flags & FNM_CASEFOLD) != 0 && isupper(ch)) + return (tolower(ch)); + return (ch); +} + +#define FOLDCASE(ch, flags) foldcase((unsigned char)(ch), (flags)) + +int +fnmatch(pattern, string, flags) + const char *pattern, *string; + int flags; +{ + const char *stringstart; + char c, test; + + _DIAGASSERT(pattern != NULL); + _DIAGASSERT(string != NULL); + + for (stringstart = string;;) + switch (c = FOLDCASE(*pattern++, flags)) { + case EOS: + if ((flags & FNM_LEADING_DIR) && *string == '/') + return (0); + return (*string == EOS ? 0 : FNM_NOMATCH); + case '?': + if (*string == EOS) + return (FNM_NOMATCH); + if (*string == '/' && (flags & FNM_PATHNAME)) + return (FNM_NOMATCH); + if (*string == '.' && (flags & FNM_PERIOD) && + (string == stringstart || + ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) + return (FNM_NOMATCH); + ++string; + break; + case '*': + c = FOLDCASE(*pattern, flags); + /* Collapse multiple stars. */ + while (c == '*') + c = FOLDCASE(*++pattern, flags); + + if (*string == '.' && (flags & FNM_PERIOD) && + (string == stringstart || + ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) + return (FNM_NOMATCH); + + /* Optimize for pattern with * at end or before /. */ + if (c == EOS) { + if (flags & FNM_PATHNAME) + return ((flags & FNM_LEADING_DIR) || + strchr(string, '/') == NULL ? + 0 : FNM_NOMATCH); + else + return (0); + } else if (c == '/' && flags & FNM_PATHNAME) { + if ((string = strchr(string, '/')) == NULL) + return (FNM_NOMATCH); + break; + } + + /* General case, use recursion. */ + while ((test = FOLDCASE(*string, flags)) != EOS) { + if (!fnmatch(pattern, string, + flags & ~FNM_PERIOD)) + return (0); + if (test == '/' && flags & FNM_PATHNAME) + break; + ++string; + } + return (FNM_NOMATCH); + case '[': + if (*string == EOS) + return (FNM_NOMATCH); + if (*string == '/' && flags & FNM_PATHNAME) + return (FNM_NOMATCH); + if ((pattern = + rangematch(pattern, FOLDCASE(*string, flags), + flags)) == NULL) + return (FNM_NOMATCH); + ++string; + break; + case '\\': + if (!(flags & FNM_NOESCAPE)) { + if ((c = FOLDCASE(*pattern++, flags)) == EOS) { + c = '\\'; + --pattern; + } + } + /* FALLTHROUGH */ + default: + if (c != FOLDCASE(*string++, flags)) + return (FNM_NOMATCH); + break; + } + /* NOTREACHED */ +} + +static const char * +rangematch(pattern, test, flags) + const char *pattern; + int test, flags; +{ + int negate, ok; + char c, c2; + + _DIAGASSERT(pattern != NULL); + + /* + * A bracket expression starting with an unquoted circumflex + * character produces unspecified results (IEEE 1003.2-1992, + * 3.13.2). This implementation treats it like '!', for + * consistency with the regular expression syntax. + * J.T. Conklin (conklin@ngai.kaleida.com) + */ + if ((negate = (*pattern == '!' || *pattern == '^')) != 0) + ++pattern; + + for (ok = 0; (c = FOLDCASE(*pattern++, flags)) != ']';) { + if (c == '\\' && !(flags & FNM_NOESCAPE)) + c = FOLDCASE(*pattern++, flags); + if (c == EOS) + return (NULL); + if (*pattern == '-' + && (c2 = FOLDCASE(*(pattern+1), flags)) != EOS && + c2 != ']') { + pattern += 2; + if (c2 == '\\' && !(flags & FNM_NOESCAPE)) + c2 = FOLDCASE(*pattern++, flags); + if (c2 == EOS) + return (NULL); + if (c <= test && test <= c2) + ok = 1; + } else if (c == test) + ok = 1; + } + return (ok == negate ? NULL : pattern); +} diff --git a/pkgtools/libnbcompat/files/fseeko.c b/pkgtools/libnbcompat/files/fseeko.c deleted file mode 100644 index 95b11bd4196..00000000000 --- a/pkgtools/libnbcompat/files/fseeko.c +++ /dev/null @@ -1,40 +0,0 @@ -/* $NetBSD: fseeko.c,v 1.2 2003/09/06 23:03:02 grant Exp $ */ - -/* - * Copyright 2002 Luke Mewburn <lukem@netbsd.org>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "nbcompat.h" - -int -fseeko(FILE *stream, off_t offset, int whence) -{ - if (offset > (off_t)LONG_MAX) { - errno = EINVAL; - return (-1); - } - return (fseek(stream, (long) offset, whence)); -} diff --git a/pkgtools/libnbcompat/files/inet_ntop.c b/pkgtools/libnbcompat/files/inet_ntop.c deleted file mode 100644 index b2681e8d014..00000000000 --- a/pkgtools/libnbcompat/files/inet_ntop.c +++ /dev/null @@ -1,191 +0,0 @@ -/* $NetBSD: inet_ntop.c,v 1.2 2003/09/06 23:03:02 grant Exp $ */ - -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include "nbcompat.h" - -#if HAVE_ARPA_NAMESER_H -#include <arpa/nameser.h> -#endif - -#ifndef IN6ADDRSZ -#define IN6ADDRSZ 16 -#endif - -#ifndef INT16SZ -#define INT16SZ 2 -#endif - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static const char *inet_ntop4(const u_char *src, char *dst, size_t size); -static const char *inet_ntop6(const u_char *src, char *dst, size_t size); - -/* char * - * inet_ntop(af, src, dst, size) - * convert a network format address to presentation format. - * return: - * pointer to presentation format address (`dst'), or NULL (see errno). - * author: - * Paul Vixie, 1996. - */ -const char * -inet_ntop(int af, const void *src, char *dst, size_t size) -{ - - switch (af) { - case AF_INET: - return (inet_ntop4(src, dst, size)); -#ifdef INET6 - case AF_INET6: - return (inet_ntop6(src, dst, size)); -#endif - default: - errno = EAFNOSUPPORT; - return (NULL); - } - /* NOTREACHED */ -} - -/* const char * - * inet_ntop4(src, dst, size) - * format an IPv4 address, more or less like inet_ntoa() - * return: - * `dst' (as a const) - * notes: - * (1) uses no statics - * (2) takes a u_char* not an in_addr as input - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop4(const u_char *src, char *dst, size_t size) -{ - static const char fmt[] = "%u.%u.%u.%u"; - char tmp[sizeof "255.255.255.255"]; - - if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { - errno = ENOSPC; - return (NULL); - } - strcpy(dst, tmp); - return (dst); -} - -#ifdef INET6 -/* const char * - * inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop6(const u_char *src, char *dst, size_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; - struct { int base, len; } best, cur; - u_int words[IN6ADDRSZ / INT16SZ]; - int i; - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof words); - for (i = 0; i < IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - best.base = -1; - cur.base = -1; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { - if (words[i] == 0) { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) - *tp++ = ':'; - continue; - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *tp++ = ':'; - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) - return (NULL); - tp += strlen(tp); - break; - } - tp += SPRINTF((tp, "%x", words[i])); - } - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { - errno = ENOSPC; - return (NULL); - } - strcpy(dst, tmp); - return (dst); -} -#endif diff --git a/pkgtools/libnbcompat/files/inet_pton.c b/pkgtools/libnbcompat/files/inet_pton.c deleted file mode 100644 index e160cb30265..00000000000 --- a/pkgtools/libnbcompat/files/inet_pton.c +++ /dev/null @@ -1,285 +0,0 @@ -/* $NetBSD: inet_pton.c,v 1.2 2003/09/06 23:03:03 grant Exp $ */ - -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include "nbcompat.h" - -#if HAVE_ARPA_NAMESER_H -#include <arpa/nameser.h> -#endif - -#ifndef INADDRSZ -#define INADDRSZ 4 -#endif - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4(const char *src, u_char *dst, int pton); -#ifdef INET6 -static int inet_pton6(const char *src, u_char *dst); -#endif - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * author: - * Paul Vixie, 1996. - */ -int -inet_pton(int af, const char *src, void *dst) -{ - - switch (af) { - case AF_INET: - return (inet_pton4(src, dst, 1)); -#ifdef INET6 - case AF_INET6: - return (inet_pton6(src, dst)); -#endif - default: - errno = EAFNOSUPPORT; - return (-1); - } - /* NOTREACHED */ -} - -/* int - * inet_pton4(src, dst, pton) - * when last arg is 0: inet_aton(). with hexadecimal, octal and shorthand. - * when last arg is 1: inet_pton(). decimal dotted-quad only. - * return: - * 1 if `src' is a valid input, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4(const char *src, u_char *dst, int pton) -{ - u_int val; - u_int digit; - int base, n; - unsigned char c; - u_int parts[4]; - register u_int *pp = parts; - - c = *src; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit(c)) - return (0); - val = 0; base = 10; - if (c == '0') { - c = *++src; - if (c == 'x' || c == 'X') - base = 16, c = *++src; - else if (isdigit(c) && c != '9') - base = 8; - } - /* inet_pton() takes decimal only */ - if (pton && base != 10) - return (0); - for (;;) { - if (isdigit(c)) { - digit = c - '0'; - if (digit >= base) - break; - val = (val * base) + digit; - c = *++src; - } else if (base == 16 && isxdigit(c)) { - digit = c + 10 - (islower(c) ? 'a' : 'A'); - if (digit >= 16) - break; - val = (val << 4) | digit; - c = *++src; - } else - break; - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - * a (with a treated as 32 bits) - */ - if (pp >= parts + 3) - return (0); - *pp++ = val; - c = *++src; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && !isspace(c)) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - /* inet_pton() takes dotted-quad only. it does not take shorthand. */ - if (pton && n != 4) - return (0); - switch (n) { - - case 0: - return (0); /* initial nondigit */ - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (parts[0] > 0xff || val > 0xffffff) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if ((parts[0] | parts[1]) > 0xff || val > 0xffff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if ((parts[0] | parts[1] | parts[2] | val) > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (dst) { - val = htonl(val); - memcpy(dst, &val, INADDRSZ); - } - return (1); -} - -#ifdef INET6 -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6(const char *src, u_char *dst) -{ - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - u_int val; - - memset((tp = tmp), '\0', IN6ADDRSZ); - endp = tp + IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') { - curtok = src; - if (!saw_xdigit) { - if (colonp) - return (0); - colonp = tp; - continue; - } else if (*src == '\0') - return (0); - if (tp + INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + INADDRSZ) <= endp) && - inet_pton4(curtok, tp, 1) > 0) { - tp += INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (saw_xdigit) { - if (tp + INT16SZ > endp) - return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; - } - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - if (tp == endp) - return (0); - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - memcpy(dst, tmp, IN6ADDRSZ); - return (1); -} -#endif diff --git a/pkgtools/libnbcompat/files/nbcompat.h b/pkgtools/libnbcompat/files/nbcompat.h index b939078e21a..a766af48afe 100644 --- a/pkgtools/libnbcompat/files/nbcompat.h +++ b/pkgtools/libnbcompat/files/nbcompat.h @@ -1,4 +1,4 @@ -/* $NetBSD: nbcompat.h,v 1.34 2004/05/12 21:50:43 grant Exp $ */ +/* $NetBSD: nbcompat.h,v 1.35 2004/08/06 16:55:09 jlam Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -66,6 +66,12 @@ #include <termios.h> #include <unistd.h> +/* Augment <sys/queue.h> with any needed macros that are missing. */ +#if HAVE_SYS_QUEUE_H +# include <sys/queue.h> +#endif +#include <nbcompat/queue.h> + #if !HAVE_POLL # undef HAVE_POLL_H # undef HAVE_SYS_POLL_H @@ -87,9 +93,10 @@ # endif #endif -#if HAVE_FTS_H -# include <fts.h> -#else +#if HAVE_NBCOMPAT_FTS +# if HAVE_FTS_H +# undef HAVE_FTS_H +# endif # include <nbcompat/fts.h> #endif @@ -104,115 +111,6 @@ # endif #endif -#if HAVE_SYS_QUEUE_H -# include <sys/queue.h> -#else -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (/*CONSTCOND*/0) - -#define LIST_INIT(head) do { \ - (head)->lh_first = NULL; \ -} while (/*CONSTCOND*/0) -#endif /* HAVE_SYS_QUEUE_H */ - -#ifndef LIST_EMPTY -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#endif -#ifndef LIST_FIRST -#define LIST_FIRST(head) ((head)->lh_first) -#endif -#ifndef LIST_NEXT -#define LIST_NEXT(elm, field) ((elm)->field.le_next) -#endif - -#if HAVE_SYS_QUEUE_H -# include <sys/queue.h> -#else -#define TAILQ_HEAD(name, type) \ -struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ -} - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define TAILQ_ENTRY(type) \ -struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ -} - -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) -#endif /* HAVE_SYS_QUEUE_H */ - -#ifndef TAILQ_HEAD_INITIALIZER -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } -#endif -#ifndef TAILQ_EMPTY -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#endif -#ifndef TAILQ_FIRST -#define TAILQ_FIRST(head) ((head)->tqh_first) -#endif -#ifndef TAILQ_NEXT -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#endif -#ifndef TAILQ_FOREACH -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); \ - (var); \ - (var) = ((var)->field.tqe_next)) -#endif - #if HAVE_ASSERT_H # include <assert.h> #endif @@ -223,11 +121,12 @@ struct { \ # include <nbcompat/err.h> #endif -/* always use our glob.h */ -#if HAVE_GLOB_H -# undef HAVE_GLOB_H +#if HAVE_NBCOMPAT_GLOB +# if HAVE_GLOB_H +# undef HAVE_GLOB_H +# endif +# include <nbcompat/glob.h> #endif -#include <nbcompat/glob.h> #if HAVE_SYS_MKDEV_H # include <sys/mkdev.h> @@ -236,10 +135,6 @@ struct { \ # endif #endif -#if HAVE_SYS_MOUNT_H -# include <sys/mount.h> -#endif - #if HAVE_PATHS_H # include <paths.h> #endif @@ -258,17 +153,6 @@ struct { \ # endif /* DEFTAPE */ #endif /* _PATH_DEFTAPE */ -typedef struct _stringlist { - char **sl_str; - size_t sl_max; - size_t sl_cur; -} StringList; - -StringList *sl_init(void); -int sl_add(StringList *, char *); -void sl_free(StringList *, int); -char *sl_find(StringList *, char *); - #if HAVE_TERMCAP_H # include <termcap.h> #else @@ -331,21 +215,24 @@ void tputs(const char *, int, int (*)(int)); # endif #endif -#if HAVE_MD5_H -# include <md5.h> -#else +#if HAVE_NBCOMPAT_MD5 +# if HAVE_MD5_H +# undef HAVE_MD5_H +# endif # include <nbcompat/md5.h> #endif -#if HAVE_RMD160_H -# include <rmd160.h> -#else +#if HAVE_NBCOMPAT_RMD160 +# if HAVE_RMD160_H +# undef HAVE_RMD160_H +# endif # include <nbcompat/rmd160.h> #endif -#if HAVE_SHA1_H -# include <sha1.h> -#else +#if HAVE_NBCOMPAT_SHA1 +# if HAVE_SHA1_H +# undef HAVE_SHA1_H +# endif # include <nbcompat/sha1.h> #endif @@ -353,19 +240,13 @@ void tputs(const char *, int, int (*)(int)); # if HAVE_VIS_H # undef HAVE_VIS_H # endif -#endif - -#if HAVE_VIS_H -# include <vis.h> -#else # include <nbcompat/vis.h> #endif -#if HAVE_GETOPT_H -# include <getopt.h> -#endif - #if HAVE_NBCOMPAT_GETOPT_LONG +# if HAVE_GETOPT_H +# undef HAVE_GETOPT_H +# endif # include <nbcompat/getopt.h> #endif @@ -408,10 +289,6 @@ int pclose(FILE *); char *fgetln(FILE *, size_t *); #endif -#if !HAVE_FSEEKO -int fseeko(FILE *, off_t, int); -#endif - #if !HAVE_FPARSELN # define FPARSELN_UNESCESC 0x01 # define FPARSELN_UNESCCONT 0x02 @@ -421,14 +298,6 @@ int fseeko(FILE *, off_t, int); char *fparseln(FILE *, size_t *, size_t *, const char[3], int); #endif -#if !HAVE_INET_NTOP -const char *inet_ntop(int, const void *, char *, size_t); -#endif - -#if !HAVE_INET_PTON -int inet_pton(int, const char *, void *); -#endif - #if !HAVE_MKSTEMP int mkstemp(char *); #endif @@ -466,10 +335,6 @@ char *strerror(int); void strmode(mode_t, char *); #endif -#if !HAVE_STRPTIME || !HAVE_STRPTIME_D -char *strptime(const char *, const char *, struct tm *); -#endif - #if HAVE_WORKING_LONG_LONG # if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG) long long strtoll(const char *, char **, int); @@ -500,10 +365,6 @@ long long strtoll(const char *, char **, int); # define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */ #endif -#if !HAVE_TIMEGM -time_t timegm(struct tm *); -#endif - #if !HAVE_HSTRERROR char *strerror(int); #endif @@ -536,11 +397,15 @@ int uid_from_user(const char *, uid_t *); int gid_from_group(const char *, gid_t *); #endif -#if HAVE_NBCOMPAT_STATFS -# if HAVE_SYS_STATFS_H -# undef HAVE_SYS_STATFS_H +#if !HAVE_FNMATCH +# include <nbcompat/fnmatch.h> +#endif + +#if HAVE_NBCOMPAT_STATVFS +# if HAVE_SYS_STATVFS_H +# undef HAVE_SYS_STATVFS_H # endif -# include <nbcompat/statfs.h> +# include <nbcompat/statvfs.h> #endif #if !HAVE_MEMMOVE @@ -593,16 +458,16 @@ int gid_from_group(const char *, gid_t *); # define UID_MAX 2147483647U /* max value for a uid_t (2^31-2) */ #endif -#ifndef HAVE_SETMODE +#if !HAVE_SETMODE void *setmode(const char *); #endif -#ifndef HAVE_GETMODE +#if !HAVE_GETMODE mode_t getmode(const void *, mode_t); #endif -#ifndef HAVE_UTIMES +#if !HAVE_UTIMES int utimes(const char *, const struct timeval *); #endif -#endif /* _NBCOMPAT_H */ +#endif /* !_NBCOMPAT_H */ diff --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in index d4ca0165305..01bb248e48e 100644 --- a/pkgtools/libnbcompat/files/nbcompat/config.h.in +++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in @@ -43,12 +43,15 @@ /* Define to 1 if you have the `fgetln' function. */ #undef HAVE_FGETLN +/* Define to 1 if you have the `fnmatch' function. */ +#undef HAVE_FNMATCH + +/* Define to 1 if you have the <fnmatch.h> header file. */ +#undef HAVE_FNMATCH_H + /* Define to 1 if you have the `fparseln' function. */ #undef HAVE_FPARSELN -/* Define to 1 if you have the `fseeko' function. */ -#undef HAVE_FSEEKO - /* Define to 1 if the system has the type `fsid_t'. */ #undef HAVE_FSID_T @@ -73,15 +76,12 @@ /* Define to 1 if you have the `gid_from_group' function. */ #undef HAVE_GID_FROM_GROUP +/* Define to 1 if you have the <glob.h> header file. */ +#undef HAVE_GLOB_H + /* Define to 1 if you have the `group_from_gid' function. */ #undef HAVE_GROUP_FROM_GID -/* Define to 1 if you have the `inet_ntop' function. */ -#undef HAVE_INET_NTOP - -/* Define to 1 if you have the `inet_pton' function. */ -#undef HAVE_INET_PTON - /* Define to 1 if the system has the type `int16_t'. */ #undef HAVE_INT16_T @@ -152,17 +152,35 @@ /* Define to 1 if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP +/* Define to 1 if the `fts_*' functions are built into the library. */ +#undef HAVE_NBCOMPAT_FTS + /* Define to 1 if the `getopt_long' function is built into the library. */ #undef HAVE_NBCOMPAT_GETOPT_LONG +/* Define to 1 if the `glob' function is built into the library. */ +#undef HAVE_NBCOMPAT_GLOB + +/* Define to 1 if the `MD5*' functions are built into the library. */ +#undef HAVE_NBCOMPAT_MD5 + /* Define to 1 if the `MD5Init' function is built into the library. */ #undef HAVE_NBCOMPAT_MD5INIT /* Define to 1 if the `poll' function is built into the library. */ #undef HAVE_NBCOMPAT_POLL -/* Define to 1 if the `statfs' function is built into the library. */ -#undef HAVE_NBCOMPAT_STATFS +/* Define to 1 if the `queue' macros are supplied by the library. */ +#undef HAVE_NBCOMPAT_QUEUE + +/* Define to 1 if the `RMD160*' functions are built into the library. */ +#undef HAVE_NBCOMPAT_RMD160 + +/* Define to 1 if the `SHA1*' functions are built into the library. */ +#undef HAVE_NBCOMPAT_SHA1 + +/* Define to 1 if the `statvfs' function is built into the library. */ +#undef HAVE_NBCOMPAT_STATVFS /* Define to 1 if the `vis' function is built into the library. */ #undef HAVE_NBCOMPAT_VIS @@ -273,9 +291,6 @@ /* Define to 1 if you have the `strmode' function. */ #undef HAVE_STRMODE -/* Define to 1 if you have the `strptime' function. */ -#undef HAVE_STRPTIME - /* Define to 1 if you have the `strsep' function. */ #undef HAVE_STRSEP @@ -285,8 +300,11 @@ /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL -/* Define to 1 if `f_basetype' is member of `struct statvfs'. */ -#undef HAVE_STRUCT_STATVFS_F_BASETYPE +/* Define to 1 if `f_fsize' is member of `struct statfs'. */ +#undef HAVE_STRUCT_STATFS_F_FSIZE + +/* Define to 1 if `f_iosize' is member of `struct statfs'. */ +#undef HAVE_STRUCT_STATFS_F_IOSIZE /* Define to 1 if you have the `strunvis' function. */ #undef HAVE_STRUNVIS @@ -357,9 +375,6 @@ /* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H -/* Define to 1 if you have the `timegm' function. */ -#undef HAVE_TIMEGM - /* Define to 1 if you have the <time.h> header file. */ #undef HAVE_TIME_H diff --git a/pkgtools/libnbcompat/files/nbcompat/fnmatch.h b/pkgtools/libnbcompat/files/nbcompat/fnmatch.h new file mode 100644 index 00000000000..30348b5a06c --- /dev/null +++ b/pkgtools/libnbcompat/files/nbcompat/fnmatch.h @@ -0,0 +1,48 @@ +/* $NetBSD: fnmatch.h,v 1.1 2004/08/06 16:55:09 jlam Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _NBCOMPAT_FNMATCH_H_ +#define _NBCOMPAT_FNMATCH_H_ + +#define FNM_NOMATCH 1 /* Match failed. */ +#define FNM_NOSYS 2 /* Function not implemented. */ + +#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ +#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ +#define FNM_PERIOD 0x04 /* Period must be matched by period. */ +#define FNM_CASEFOLD 0x08 /* Pattern is matched case-insensitive */ +#define FNM_LEADING_DIR 0x10 /* Ignore /<tail> after Imatch. */ + +int fnmatch(const char *, const char *, int); + +#endif /* !_NBCOMPAT_FNMATCH_H_ */ diff --git a/pkgtools/libnbcompat/files/nbcompat/queue.h b/pkgtools/libnbcompat/files/nbcompat/queue.h new file mode 100644 index 00000000000..84873f99236 --- /dev/null +++ b/pkgtools/libnbcompat/files/nbcompat/queue.h @@ -0,0 +1,166 @@ +/* $NetBSD: queue.h,v 1.1 2004/08/06 16:55:09 jlam Exp $ */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _NBCOMPAT_QUEUE_H +#define _NBCOMPAT_QUEUE_H + +#ifndef LIST_HEAD +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} +#endif + +#ifndef LIST_HEAD_INITIALIZER +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } +#endif + +#ifndef LIST_ENTRY +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} +#endif + +#ifndef LIST_INSERT_HEAD +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) +#endif + +#ifndef LIST_INIT +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (/*CONSTCOND*/0) +#endif + +#ifndef LIST_EMPTY +#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#endif +#ifndef LIST_FIRST +#define LIST_FIRST(head) ((head)->lh_first) +#endif +#ifndef LIST_NEXT +#define LIST_NEXT(elm, field) ((elm)->field.le_next) +#endif + +#ifndef TAILQ_HEAD +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} +#endif + +#ifndef TAILQ_HEAD_INITIALIZER +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } +#endif + +#ifndef TAILQ_ENTRY +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} +#endif + +#ifndef TAILQ_INIT +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) +#endif + +#ifndef TAILQ_INSERT_HEAD +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) +#endif + +#ifndef TAILQ_INSERT_TAIL +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) +#endif + +#ifndef TAILQ_REMOVE +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) +#endif + +#ifndef TAILQ_HEAD_INITIALIZER +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } +#endif +#ifndef TAILQ_EMPTY +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#endif +#ifndef TAILQ_FIRST +#define TAILQ_FIRST(head) ((head)->tqh_first) +#endif +#ifndef TAILQ_NEXT +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#endif +#ifndef TAILQ_FOREACH +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var); \ + (var) = ((var)->field.tqe_next)) +#endif + +#endif /* !_NBCOMPAT_QUEUE_H */ diff --git a/pkgtools/libnbcompat/files/nbcompat/statfs.h b/pkgtools/libnbcompat/files/nbcompat/statfs.h deleted file mode 100644 index 1495f74315b..00000000000 --- a/pkgtools/libnbcompat/files/nbcompat/statfs.h +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: statfs.h,v 1.2 2004/03/11 13:28:45 grant Exp $ */ - -#ifndef _NBCOMPAT_STATFS_H -#define _NBCOMPAT_STATFS_H - -#if HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#if HAVE_SYS_MOUNT_H -#include <sys/mount.h> -#endif - -#if HAVE_SYS_STATVFS_H -#include <sys/statvfs.h> -#endif - -#if HAVE_SYS_VFS_H -#include <sys/vfs.h> -#endif - -#ifndef MFSNAMELEN -#define MFSNAMELEN 16 /* length of fs type name, including nul */ -#endif -#ifndef MNAMELEN -#define MNAMELEN 90 /* length of buffer for returned name */ -#endif - -#if !HAVE_FSID_T -typedef struct { int32_t val[2]; } fsid_t; -#endif - -struct statfs { - short f_type; /* type of file system */ - u_short f_flags; /* copy of mount flags */ - long f_bsize; /* fundamental file system block size */ - long f_iosize; /* optimal transfer block size */ - long f_blocks; /* total data blocks in file system */ - long f_bfree; /* free blocks in fs */ - long f_bavail; /* free blocks avail to non-superuser */ - long f_files; /* total file nodes in file system */ - long f_ffree; /* free file nodes in fs */ - fsid_t f_fsid; /* file system id */ - uid_t f_owner; /* user that mounted the file system */ - long f_spare[4]; /* spare for later */ - char f_fstypename[MFSNAMELEN]; /* fs type name */ - char f_mntonname[MNAMELEN]; /* directory on which mounted */ - char f_mntfromname[MNAMELEN]; /* mounted file system */ -}; - -#ifndef MNT_RDONLY -#define MNT_RDONLY 0x00000001 /* read only filesystem */ -#endif - -#ifndef MNT_NOSUID -#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ -#endif - -int statfs(const char *path, struct statfs *sfs); -int fstatfs(int fd, struct statfs *sfs); - -#endif /* !_NBCOMPAT_STATFS_H */ diff --git a/pkgtools/libnbcompat/files/nbcompat/statvfs.h b/pkgtools/libnbcompat/files/nbcompat/statvfs.h new file mode 100644 index 00000000000..4fc07412086 --- /dev/null +++ b/pkgtools/libnbcompat/files/nbcompat/statvfs.h @@ -0,0 +1,127 @@ +/* $NetBSD: statvfs.h,v 1.1 2004/08/06 16:55:09 jlam Exp $ */ + +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _NBCOMPAT_STATVFS_H +#define _NBCOMPAT_STATVFS_H + +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#if HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif + +#if HAVE_SYS_STATFS_H +#include <sys/statfs.h> +#endif + +#if HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif + +#if HAVE_STDINT_H +#include <stdint.h> +#endif + +#define VFS_NAMELEN 32 +#define VFS_MNAMELEN 1024 + +typedef uint64_t fsblkcnt_t; /* fs block count (statvfs) */ +typedef uint64_t fsfilcnt_t; /* fs file count */ + +#if !HAVE_FSID_T +typedef struct { int32_t val[2]; } fsid_t; +#endif + +struct statvfs { + unsigned long f_flag; /* copy of mount exported flags */ + unsigned long f_bsize; /* system block size */ + unsigned long f_frsize; /* system fragment size */ + unsigned long f_iosize; /* optimal file system block size */ + + fsblkcnt_t f_blocks; /* number of blocks in file system */ + fsblkcnt_t f_bfree; /* free blocks avail in file system */ + fsblkcnt_t f_bavail; /* free blocks avail to non-root */ + fsblkcnt_t f_bresvd; /* blocks reserved for root */ + + fsfilcnt_t f_files; /* total file nodes in file system */ + fsfilcnt_t f_ffree; /* free file nodes in file system */ + fsfilcnt_t f_favail; /* free file nodes avail to non-root */ + fsfilcnt_t f_fresvd; /* file nodes reserved for root */ + + uint64_t f_syncreads; /* count of sync reads since mount */ + uint64_t f_syncwrites; /* count of sync writes since mount */ + + uint64_t f_asyncreads; /* count of async reads since mount */ + uint64_t f_asyncwrites; /* count of async writes since mount */ + + fsid_t f_fsidx; /* NetBSD compatible fsid */ + unsigned long f_fsid; /* Posix compatible fsid */ + unsigned long f_namemax; /* maximum filename length */ + uint32_t f_owner; /* user that mounted the file system */ + + uint32_t f_spare[4]; /* spare space */ + + char f_fstypename[VFS_NAMELEN]; /* fs type name */ + char f_mntonname[VFS_MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[VFS_MNAMELEN]; /* mounted file system */ +}; + +#ifndef MNT_RDONLY +#define MNT_RDONLY 0x00000001 /* read only filesystem */ +#endif +#ifndef ST_RDONLY +#define ST_RDONLY MNT_RDONLY +#endif + +#ifndef MNT_NOSUID +#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ +#endif +#ifndef ST_NOSUID +#define ST_NOSUID MNT_NOSUID +#endif + +int statvfs(const char *path, struct statvfs *vfs); +int fstatvfs(int fd, struct statvfs *vfs); + +#endif /* !_NBCOMPAT_STATVFS_H */ diff --git a/pkgtools/libnbcompat/files/sl_init.c b/pkgtools/libnbcompat/files/sl_init.c deleted file mode 100644 index f9f05c5aed3..00000000000 --- a/pkgtools/libnbcompat/files/sl_init.c +++ /dev/null @@ -1,119 +0,0 @@ -/* $NetBSD: sl_init.c,v 1.2 2003/09/06 23:03:04 grant Exp $ */ - -/*- - * Copyright (c) 1994, 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "nbcompat.h" - -#define _SL_CHUNKSIZE 20 - -/* - * sl_init(): Initialize a string list - */ -StringList * -sl_init(void) -{ - StringList *sl; - - sl = malloc(sizeof(StringList)); - if (sl == NULL) - return (NULL); - - sl->sl_cur = 0; - sl->sl_max = _SL_CHUNKSIZE; - sl->sl_str = malloc(sl->sl_max * sizeof(char *)); - if (sl->sl_str == NULL) { - free(sl); - sl = NULL; - } - return (sl); -} - - -/* - * sl_add(): Add an item to the string list - */ -int -sl_add(StringList *sl, char *name) -{ - if (sl->sl_cur == sl->sl_max - 1) { - char **new; - - sl->sl_max += _SL_CHUNKSIZE; - new = (char **)realloc(sl->sl_str, sl->sl_max * sizeof(char *)); - if (new == NULL) - return (-1); - sl->sl_str = new; - } - sl->sl_str[sl->sl_cur++] = name; - return (0); -} - - -/* - * sl_free(): Free a stringlist - */ -void -sl_free(StringList *sl, int all) -{ - size_t i; - - if (sl == NULL) - return; - if (sl->sl_str) { - if (all) - for (i = 0; i < sl->sl_cur; i++) - free(sl->sl_str[i]); - free(sl->sl_str); - } - free(sl); -} - - -/* - * sl_find(): Find a name in the string list - */ -char * -sl_find(StringList *sl, char *name) -{ - size_t i; - - for (i = 0; i < sl->sl_cur; i++) - if (strcmp(sl->sl_str[i], name) == 0) - return sl->sl_str[i]; - - return (NULL); -} diff --git a/pkgtools/libnbcompat/files/src2nbcompat b/pkgtools/libnbcompat/files/src2nbcompat index b289fd8a903..e261bbe687e 100755 --- a/pkgtools/libnbcompat/files/src2nbcompat +++ b/pkgtools/libnbcompat/files/src2nbcompat @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: src2nbcompat,v 1.4 2003/12/08 13:39:11 grant Exp $ +# $NetBSD: src2nbcompat,v 1.5 2004/08/06 16:55:09 jlam Exp $ # # Copyright (c) 2003 The NetBSD Foundation, Inc. # All rights reserved. @@ -81,6 +81,12 @@ for f in $files; do # Skip copying over the Makefiles since we'll be using # a GNU autoconf-based build infrastructure. ;; + *.sh) + # Assume shell scripts will require variable substitution + # by the GNU configure script. + # + cp $newf $dest/$newf.in + ;; *.[ch]) # Add "#include <nbcompat.h>" before the first system # header inclusion. Protect all system headers with diff --git a/pkgtools/libnbcompat/files/statfs.c b/pkgtools/libnbcompat/files/statfs.c deleted file mode 100644 index 60831dd3bf9..00000000000 --- a/pkgtools/libnbcompat/files/statfs.c +++ /dev/null @@ -1,151 +0,0 @@ -/* $NetBSD: statfs.c,v 1.5 2004/03/11 13:28:45 grant Exp $ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#if HAVE_CONFIG_H -#include "nbcompat/nbconfig.h" -#endif - -#if HAVE_STRING_H -#include <string.h> -#endif - -#include "nbcompat/statfs.h" - -static void vfs2fs(struct statfs *, const struct statvfs *); - -static void -vfs2fs(struct statfs *sfs, const struct statvfs *vfs) -{ - sfs->f_type = 0; /* ok */ - sfs->f_flags = 0; - if (vfs->f_flag & ST_RDONLY) - sfs->f_flags |= MNT_RDONLY; - if (vfs->f_flag & ST_NOSUID) - sfs->f_flags |= MNT_NOSUID; - - /* - * From a quick survey of f_bsize, f_iosize, and f_frsize on - * various NetBSD and Solaris systems, with varying fragment and - * block sizes: - * - * f_bsize f_iosize f_frsize - * netbsd 1k/8k 1024 8192 - * netbsd 2k/16k 2048 16384 - * solaris 1k/8k 8192 1024 - * solaris 2k/8k 8192 2048 - * solaris 512/4k 4096 512 - * - * It is apparent that: - * - * - netbsd's f_bsize is equivalent to the fragment size of the - * underlying filesystem - * - netbsd's f_iosize is equivalent to the block size of the - * underlying filesystem - * - solaris's f_bsize is equivalent to the block size of the - * underlying filesystem - * - solaris's f_frsize is equivalent to the fragment size of the - * underlying filesystem - * - * NetBSD's statfs(2) man page (and sys/mount.h header file) says: - * - * long f_bsize; /* fundamental file system block size * / - * long f_iosize; /* optimal transfer block size * / - * - * and Solaris's statvfs(2) man page says: - * - * u_long f_bsize; /* preferred file system block size * / - * u_long f_frsize; /* fundamental filesystem block - * (size if supported) * / - * - * so it makes sense that their f_frsize == our f_bsize. - * - * I see that Solaris's sys/statvfs.h says: - * - * unsigned long f_bsize; /* fundamental file system block size * / - * unsigned long f_frsize; /* fragment size * / - * - * but empiric testing (above) seems to indicate that the comments - * in their code are wrong. The following two assignments, even - * though they may look wrong, are actually correct. - */ - sfs->f_bsize = vfs->f_frsize; - sfs->f_iosize = vfs->f_bsize; - sfs->f_blocks = vfs->f_blocks; - sfs->f_bfree = vfs->f_bfree; - sfs->f_bavail = vfs->f_bavail; - sfs->f_files = vfs->f_files; - sfs->f_ffree = vfs->f_ffree; - (void) memcpy(&sfs->f_fsid.val[0], &vfs->f_fsid, sizeof(fsid_t)); - sfs->f_owner = 0; /* XXX: root always here */ -#if HAVE_STRUCT_STATVFS_F_BASETYPE - (void)strncpy(sfs->f_fstypename, - vfs->f_basetype, sizeof(sfs->f_fstypename)); -#else - sfs->f_fstypename[0] = '\0'; -#endif - sfs->f_mntonname[0] = '\0'; /* XXX: */ - sfs->f_mntfromname[0] = '\0'; /* XXX: */ -} - -int -statfs(path, sfs) - const char *path; - struct statfs *sfs; -{ - struct statvfs vfs; - - if (statvfs(path, &vfs) == -1) - return -1; - vfs2fs(sfs, &vfs); - return 0; - -} - -int -fstatfs(fd, sfs) - int fd; - struct statfs *sfs; -{ - struct statvfs vfs; - - if (fstatvfs(fd, &vfs) == -1) - return -1; - - vfs2fs(sfs, &vfs); - return 0; -} diff --git a/pkgtools/libnbcompat/files/statvfs.c b/pkgtools/libnbcompat/files/statvfs.c new file mode 100644 index 00000000000..7dcca106825 --- /dev/null +++ b/pkgtools/libnbcompat/files/statvfs.c @@ -0,0 +1,126 @@ +/* $NetBSD: statvfs.c,v 1.1 2004/08/06 16:55:09 jlam Exp $ */ + +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#if HAVE_CONFIG_H +#include "nbcompat/nbconfig.h" +#endif + +#if HAVE_STRING_H +#include <string.h> /* memcpy() */ +#endif + +#include "nbcompat/statvfs.h" + +static void fs2vfs(struct statvfs *vfs, const struct statfs *sfs); + +static void +fs2vfs(struct statvfs *vfs, const struct statfs *sfs) +{ + vfs->f_flag = 0; + if (sfs->f_flags & MNT_RDONLY) + vfs->f_flag |= ST_RDONLY; + if (sfs->f_flags & MNT_NOSUID) + vfs->f_flag |= ST_NOSUID; + +#if HAVE_STRUCT_STATFS_F_FSIZE + vfs->f_bsize = sfs->f_fsize +#else + vfs->f_bsize = sfs->f_bsize; +#endif + vfs->f_frsize = sfs->f_bsize; +#if HAVE_STRUCT_STATFS_F_IOSIZE + vfs->f_iosize = sfs->f_iosize; +#else + vfs->f_iosize = sfs->f_bsize; +#endif + vfs->f_blocks = sfs->f_blocks; + vfs->f_bfree = sfs->f_bfree; + vfs->f_bavail = sfs->f_bavail; + vfs->f_bresvd = 0; /* XXX */ + + vfs->f_files = sfs->f_files; + vfs->f_ffree = sfs->f_ffree; + /* + * f_favail is supposed to only be free nodes available to non-root + * but that info isn't available via statfs(). Just fudge it by + * assigning it f_ffree as well, which is the total free nodes. + */ + vfs->f_favail = sfs->f_ffree; + vfs->f_fresvd = 0; /* XXX */ + + vfs->f_syncreads = 0; /* XXX */ + vfs->f_syncwrites= 0; /* XXX */ + vfs->f_asyncreads = 0; /* XXX */ + vfs->f_asyncwrites= 0; /* XXX */ + + (void) memcpy(&vfs->f_fsidx, &sfs->f_fsid, sizeof(fsid_t)); + vfs->f_fsid = sfs->f_fsid.val[0]; + +#if HAVE_STRUCT_STATFS_F_IOSIZE + vfs->f_namemax = sfs->f_name_max; +#else + vfs->f_namemax = VFS_MNAMELEN; /* XXX */ +#endif + vfs->f_owner = 0; /* XXX */ + vfs->f_fstypename[0] = '\0'; /* XXX */ + vfs->f_mntonname[0] = '\0'; /* XXX */ + vfs->f_mntfromname[0] = '\0'; /* XXX */ +} + +int +statvfs(const char *path, struct statvfs *vfs) +{ + struct statfs sfs; + + if (statfs(path, &sfs) == -1) + return -1; + fs2vfs(vfs, &sfs); + return 0; +} + +int +fstatvfs(int fd, struct statvfs *vfs) +{ + struct statfs sfs; + + if (fstatfs(fd, &sfs) == -1) + return -1; + + fs2vfs(vfs, &sfs); + return 0; +} diff --git a/pkgtools/libnbcompat/files/strptime.c b/pkgtools/libnbcompat/files/strptime.c deleted file mode 100644 index 29d4a643c59..00000000000 --- a/pkgtools/libnbcompat/files/strptime.c +++ /dev/null @@ -1,391 +0,0 @@ -/* $NetBSD: strptime.c,v 1.2 2003/09/06 23:03:05 grant Exp $ */ - -/*- - * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code was contributed to The NetBSD Foundation by Klaus Klein. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "nbcompat.h" - -/* - * We do not implement alternate representations. However, we always - * check whether a given modifier is allowed for a certain conversion. - */ -#define ALT_E 0x01 -#define ALT_O 0x02 -#define LEGAL_ALT(x) { if (alt_format & ~(x)) return (0); } - - -static int conv_num(const char **, int *, int, int); - -static const char *day[7] = { - "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", - "Friday", "Saturday" -}; -static const char *abday[7] = { - "Sun","Mon","Tue","Wed","Thu","Fri","Sat" -}; -static const char *mon[12] = { - "January", "February", "March", "April", "May", "June", "July", - "August", "September", "October", "November", "December" -}; -static const char *abmon[12] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; -static const char *am_pm[2] = { - "AM", "PM" -}; - - -char * -strptime(const char *buf, const char *fmt, struct tm *tm) -{ - char c; - const char *bp; - size_t len = 0; - int alt_format, i, split_year = 0; - - bp = buf; - - while ((c = *fmt) != '\0') { - /* Clear `alternate' modifier prior to new conversion. */ - alt_format = 0; - - /* Eat up white-space. */ - if (isspace(c)) { - while (isspace(*bp)) - bp++; - - fmt++; - continue; - } - - if ((c = *fmt++) != '%') - goto literal; - - -again: switch (c = *fmt++) { - case '%': /* "%%" is converted to "%". */ -literal: - if (c != *bp++) - return (0); - break; - - /* - * "Alternative" modifiers. Just set the appropriate flag - * and start over again. - */ - case 'E': /* "%E?" alternative conversion modifier. */ - LEGAL_ALT(0); - alt_format |= ALT_E; - goto again; - - case 'O': /* "%O?" alternative conversion modifier. */ - LEGAL_ALT(0); - alt_format |= ALT_O; - goto again; - - /* - * "Complex" conversion rules, implemented through recursion. - */ - case 'c': /* Date and time, using the locale's format. */ - LEGAL_ALT(ALT_E); - if (!(bp = strptime(bp, "%x %X", tm))) - return (0); - break; - - case 'D': /* The date as "%m/%d/%y". */ - LEGAL_ALT(0); - if (!(bp = strptime(bp, "%m/%d/%y", tm))) - return (0); - break; - - case 'R': /* The time as "%H:%M". */ - LEGAL_ALT(0); - if (!(bp = strptime(bp, "%H:%M", tm))) - return (0); - break; - - case 'r': /* The time in 12-hour clock representation. */ - LEGAL_ALT(0); - if (!(bp = strptime(bp, "%I:%M:%S %p", tm))) - return (0); - break; - - case 'T': /* The time as "%H:%M:%S". */ - LEGAL_ALT(0); - if (!(bp = strptime(bp, "%H:%M:%S", tm))) - return (0); - break; - - case 'X': /* The time, using the locale's format. */ - LEGAL_ALT(ALT_E); - if (!(bp = strptime(bp, "%H:%M:%S", tm))) - return (0); - break; - - case 'x': /* The date, using the locale's format. */ - LEGAL_ALT(ALT_E); - if (!(bp = strptime(bp, "%m/%d/%y", tm))) - return (0); - break; - - /* - * "Elementary" conversion rules. - */ - case 'A': /* The day of week, using the locale's form. */ - case 'a': - LEGAL_ALT(0); - for (i = 0; i < 7; i++) { - /* Full name. */ - len = strlen(day[i]); - if (strncasecmp(day[i], bp, len) == 0) - break; - - /* Abbreviated name. */ - len = strlen(abday[i]); - if (strncasecmp(abday[i], bp, len) == 0) - break; - } - - /* Nothing matched. */ - if (i == 7) - return (0); - - tm->tm_wday = i; - bp += len; - break; - - case 'B': /* The month, using the locale's form. */ - case 'b': - case 'h': - LEGAL_ALT(0); - for (i = 0; i < 12; i++) { - /* Full name. */ - len = strlen(mon[i]); - if (strncasecmp(mon[i], bp, len) == 0) - break; - - /* Abbreviated name. */ - len = strlen(abmon[i]); - if (strncasecmp(abmon[i], bp, len) == 0) - break; - } - - /* Nothing matched. */ - if (i == 12) - return (0); - - tm->tm_mon = i; - bp += len; - break; - - case 'C': /* The century number. */ - LEGAL_ALT(ALT_E); - if (!(conv_num(&bp, &i, 0, 99))) - return (0); - - if (split_year) { - tm->tm_year = (tm->tm_year % 100) + (i * 100); - } else { - tm->tm_year = i * 100; - split_year = 1; - } - break; - - case 'd': /* The day of month. */ - case 'e': - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &tm->tm_mday, 1, 31))) - return (0); - break; - - case 'k': /* The hour (24-hour clock representation). */ - LEGAL_ALT(0); - /* FALLTHROUGH */ - case 'H': - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &tm->tm_hour, 0, 23))) - return (0); - break; - - case 'l': /* The hour (12-hour clock representation). */ - LEGAL_ALT(0); - /* FALLTHROUGH */ - case 'I': - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &tm->tm_hour, 1, 12))) - return (0); - if (tm->tm_hour == 12) - tm->tm_hour = 0; - break; - - case 'j': /* The day of year. */ - LEGAL_ALT(0); - if (!(conv_num(&bp, &i, 1, 366))) - return (0); - tm->tm_yday = i - 1; - break; - - case 'M': /* The minute. */ - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &tm->tm_min, 0, 59))) - return (0); - break; - - case 'm': /* The month. */ - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &i, 1, 12))) - return (0); - tm->tm_mon = i - 1; - break; - - case 'p': /* The locale's equivalent of AM/PM. */ - LEGAL_ALT(0); - /* AM? */ - if (strcasecmp(am_pm[0], bp) == 0) { - if (tm->tm_hour > 11) - return (0); - - bp += strlen(am_pm[0]); - break; - } - /* PM? */ - else if (strcasecmp(am_pm[1], bp) == 0) { - if (tm->tm_hour > 11) - return (0); - - tm->tm_hour += 12; - bp += strlen(am_pm[1]); - break; - } - - /* Nothing matched. */ - return (0); - - case 'S': /* The seconds. */ - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &tm->tm_sec, 0, 61))) - return (0); - break; - - case 'U': /* The week of year, beginning on sunday. */ - case 'W': /* The week of year, beginning on monday. */ - LEGAL_ALT(ALT_O); - /* - * XXX This is bogus, as we can not assume any valid - * information present in the tm structure at this - * point to calculate a real value, so just check the - * range for now. - */ - if (!(conv_num(&bp, &i, 0, 53))) - return (0); - break; - - case 'w': /* The day of week, beginning on sunday. */ - LEGAL_ALT(ALT_O); - if (!(conv_num(&bp, &tm->tm_wday, 0, 6))) - return (0); - break; - - case 'Y': /* The year. */ - LEGAL_ALT(ALT_E); - if (!(conv_num(&bp, &i, 0, 9999))) - return (0); - - tm->tm_year = i - TM_YEAR_BASE; - break; - - case 'y': /* The year within 100 years of the epoch. */ - LEGAL_ALT(ALT_E | ALT_O); - if (!(conv_num(&bp, &i, 0, 99))) - return (0); - - if (split_year) { - tm->tm_year = ((tm->tm_year / 100) * 100) + i; - break; - } - split_year = 1; - if (i <= 68) - tm->tm_year = i + 2000 - TM_YEAR_BASE; - else - tm->tm_year = i + 1900 - TM_YEAR_BASE; - break; - - /* - * Miscellaneous conversions. - */ - case 'n': /* Any kind of white-space. */ - case 't': - LEGAL_ALT(0); - while (isspace(*bp)) - bp++; - break; - - - default: /* Unknown/unsupported conversion. */ - return (0); - } - - - } - - /* LINTED functional specification */ - return ((char *)bp); -} - - -static int -conv_num(const char **buf, int *dest, int llim, int ulim) -{ - int result = 0; - - /* The limit also determines the number of valid digits. */ - int rulim = ulim; - - if (**buf < '0' || **buf > '9') - return (0); - - do { - result *= 10; - result += *(*buf)++ - '0'; - rulim /= 10; - } while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9'); - - if (result < llim || result > ulim) - return (0); - - *dest = result; - return (1); -} diff --git a/pkgtools/libnbcompat/files/timegm.c b/pkgtools/libnbcompat/files/timegm.c deleted file mode 100644 index 4b32d30122c..00000000000 --- a/pkgtools/libnbcompat/files/timegm.c +++ /dev/null @@ -1,119 +0,0 @@ -/* $NetBSD: timegm.c,v 1.2 2003/09/06 23:03:06 grant Exp $ */ - -#include "nbcompat.h" - -/* - * UTC version of mktime(3) - */ - -/* - * This code is not portable, but works on most Unix-like systems. - * If the local timezone has no summer time, using mktime(3) function - * and adjusting offset would be usable (adjusting leap seconds - * is still required, though), but the assumption is not always true. - * - * Anyway, no portable and correct implementation of UTC to time_t - * conversion exists.... - */ - -static time_t -sub_mkgmt(struct tm *tm) -{ - int y, nleapdays; - time_t t; - /* days before the month */ - static const unsigned short moff[12] = { - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 - }; - - /* - * XXX: This code assumes the given time to be normalized. - * Normalizing here is impossible in case the given time is a leap - * second but the local time library is ignorant of leap seconds. - */ - - /* minimal sanity checking not to access outside of the array */ - if ((unsigned) tm->tm_mon >= 12) - return (time_t) -1; - if (tm->tm_year < EPOCH_YEAR - TM_YEAR_BASE) - return (time_t) -1; - - y = tm->tm_year + TM_YEAR_BASE - (tm->tm_mon < 2); - nleapdays = y / 4 - y / 100 + y / 400 - - ((EPOCH_YEAR-1) / 4 - (EPOCH_YEAR-1) / 100 + (EPOCH_YEAR-1) / 400); - t = ((((time_t) (tm->tm_year - (EPOCH_YEAR - TM_YEAR_BASE)) * 365 + - moff[tm->tm_mon] + tm->tm_mday - 1 + nleapdays) * 24 + - tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec; - - return (t < 0 ? (time_t) -1 : t); -} - -time_t -timegm(struct tm *tm) -{ - time_t t, t2; - struct tm *tm2; - int sec; - - /* Do the first guess. */ - if ((t = sub_mkgmt(tm)) == (time_t) -1) - return (time_t) -1; - - /* save value in case *tm is overwritten by gmtime() */ - sec = tm->tm_sec; - - tm2 = gmtime(&t); - if ((t2 = sub_mkgmt(tm2)) == (time_t) -1) - return (time_t) -1; - - if (t2 < t || tm2->tm_sec != sec) { - /* - * Adjust for leap seconds. - * - * real time_t time - * | - * tm - * / ... (a) first sub_mkgmt() conversion - * t - * | - * tm2 - * / ... (b) second sub_mkgmt() conversion - * t2 - * --->time - */ - /* - * Do the second guess, assuming (a) and (b) are almost equal. - */ - t += t - t2; - tm2 = gmtime(&t); - - /* - * Either (a) or (b), may include one or two extra - * leap seconds. Try t, t + 2, t - 2, t + 1, and t - 1. - */ - if (tm2->tm_sec == sec - || (t += 2, tm2 = gmtime(&t), tm2->tm_sec == sec) - || (t -= 4, tm2 = gmtime(&t), tm2->tm_sec == sec) - || (t += 3, tm2 = gmtime(&t), tm2->tm_sec == sec) - || (t -= 2, tm2 = gmtime(&t), tm2->tm_sec == sec)) - ; /* found */ - else { - /* - * Not found. - */ - if (sec >= 60) - /* - * The given time is a leap second - * (sec 60 or 61), but the time library - * is ignorant of the leap second. - */ - ; /* treat sec 60 as 59, - sec 61 as 0 of the next minute */ - else - /* The given time may not be normalized. */ - t++; /* restore t */ - } - } - - return (t < 0 ? (time_t) -1 : t); -} |