summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorjlam <jlam>2003-09-05 18:35:49 +0000
committerjlam <jlam>2003-09-05 18:35:49 +0000
commit00b56cfbd7a7fa5ba2d38ef7f1edb537bf00509d (patch)
tree5bb9b4c14284af926454dbf31ef25e2b5a8474db /pkgtools
parent4d262c52207d4b101c43a6be8cd2e2b5c927a0c2 (diff)
downloadpkgsrc-00b56cfbd7a7fa5ba2d38ef7f1edb537bf00509d.tar.gz
Update pkgtools/libnbcompat to 20030829. Changes from previous version
include: * Move headers out of the global namespace and into the nbcompat directory. Since there are no headers other than nbcompat.h in ${PREFIX}/include/libnbcompat, just install it directly in ${PREFIX}/include. Using libnbcompat is now a matter of including nbcompat.h at the top of *.c files and linking against -lnbcompat. * Only build functions into libnbcompat.a if they aren't already in the system libraries. * Move several *.[ch] files that are pax- or mtree-specific out of libnbcompat (they should belong with those packages). On NetBSD 1.6 systems, libnbcompat.a now contains just the bare minimum: the sha2 routines.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/libnbcompat/Makefile10
-rw-r--r--pkgtools/libnbcompat/PLIST39
-rw-r--r--pkgtools/libnbcompat/buildlink2.mk12
-rw-r--r--pkgtools/libnbcompat/files/Makefile.in26
-rwxr-xr-xpkgtools/libnbcompat/files/configure495
-rw-r--r--pkgtools/libnbcompat/files/configure.ac50
-rw-r--r--pkgtools/libnbcompat/files/extern.h114
-rw-r--r--pkgtools/libnbcompat/files/getid.c458
-rw-r--r--pkgtools/libnbcompat/files/md5c.c4
-rw-r--r--pkgtools/libnbcompat/files/md5hl.c6
-rw-r--r--pkgtools/libnbcompat/files/misc.c292
-rw-r--r--pkgtools/libnbcompat/files/mtree.h136
-rw-r--r--pkgtools/libnbcompat/files/nbcompat.h70
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/getopt.h (renamed from pkgtools/libnbcompat/files/getopt.h)4
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/glob.h (renamed from pkgtools/libnbcompat/files/ftpglob.h)4
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/md5.h (renamed from pkgtools/libnbcompat/files/md5.h)2
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in24
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/rmd160.h (renamed from pkgtools/libnbcompat/files/rmd160.h)2
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/sha1.h (renamed from pkgtools/libnbcompat/files/sha1.h)2
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/sha2.h (renamed from pkgtools/libnbcompat/files/sha2.h)0
-rw-r--r--pkgtools/libnbcompat/files/pack_dev.c313
-rw-r--r--pkgtools/libnbcompat/files/pack_dev.h47
-rw-r--r--pkgtools/libnbcompat/files/rmd160.c6
-rw-r--r--pkgtools/libnbcompat/files/rmd160hl.c6
-rw-r--r--pkgtools/libnbcompat/files/setmode.c503
-rw-r--r--pkgtools/libnbcompat/files/sha1.c4
-rw-r--r--pkgtools/libnbcompat/files/sha1hl.c6
-rw-r--r--pkgtools/libnbcompat/files/sha2.c2
-rw-r--r--pkgtools/libnbcompat/files/sha2hl.c6
-rw-r--r--pkgtools/libnbcompat/files/spec.c591
-rw-r--r--pkgtools/libnbcompat/files/stat_flags.c198
-rw-r--r--pkgtools/libnbcompat/files/stat_flags.h39
32 files changed, 578 insertions, 2893 deletions
diff --git a/pkgtools/libnbcompat/Makefile b/pkgtools/libnbcompat/Makefile
index 0c34d0f06c9..33dd2ba7b04 100644
--- a/pkgtools/libnbcompat/Makefile
+++ b/pkgtools/libnbcompat/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.18 2003/09/04 01:51:15 jlam Exp $
+# $NetBSD: Makefile,v 1.19 2003/09/05 18:35:58 jlam Exp $
#
-DISTNAME= libnbcompat-20030828
+DISTNAME= libnbcompat-20030829
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
@@ -18,9 +18,9 @@ NO_MTREE= # defined
GNU_CONFIGURE= # defined
-PKG_INFO= PKG_DBDIR=${PKG_DBDIR} ${PKG_INFO_CMD}
-PKG_CREATE= PKG_DBDIR=${PKG_DBDIR} ${PKG_CREATE_CMD}
-PKG_DELETE= PKG_DBDIR=${PKG_DBDIR} ${PKG_DELETE_CMD}
+PKG_INFO= PKG_DBDIR=${_PKG_DBDIR} ${PKG_INFO_CMD}
+PKG_CREATE= PKG_DBDIR=${_PKG_DBDIR} ${PKG_CREATE_CMD}
+PKG_DELETE= PKG_DBDIR=${_PKG_DBDIR} ${PKG_DELETE_CMD}
do-extract:
@${CP} -Rp ${FILESDIR} ${WRKSRC}
diff --git a/pkgtools/libnbcompat/PLIST b/pkgtools/libnbcompat/PLIST
index 85ee5cd4da3..c1d586a4e14 100644
--- a/pkgtools/libnbcompat/PLIST
+++ b/pkgtools/libnbcompat/PLIST
@@ -1,26 +1,19 @@
-@comment $NetBSD: PLIST,v 1.8 2003/09/03 13:11:12 jlam Exp $
-include/libnbcompat/extern.h
-include/libnbcompat/ftpglob.h
-include/libnbcompat/getopt.h
-include/libnbcompat/md5.h
-include/libnbcompat/mtree.h
-include/libnbcompat/nbcompat.h
-include/libnbcompat/nbcompat/err.h
-include/libnbcompat/nbcompat/fts.h
-include/libnbcompat/nbcompat/nbconfig.h
-include/libnbcompat/nbcompat/nbtypes.h
-include/libnbcompat/nbcompat/poll.h
-include/libnbcompat/nbcompat/statfs.h
-include/libnbcompat/nbcompat/vis.h
-include/libnbcompat/pack_dev.h
-include/libnbcompat/pwcache.h
-include/libnbcompat/rmd160.h
-include/libnbcompat/sha1.h
-include/libnbcompat/sha2.h
-include/libnbcompat/stat_flags.h
-include/libnbcompat/util.h
+@comment $NetBSD: PLIST,v 1.9 2003/09/05 18:35:58 jlam Exp $
+include/nbcompat.h
+include/nbcompat/err.h
+include/nbcompat/fts.h
+include/nbcompat/getopt.h
+include/nbcompat/glob.h
+include/nbcompat/md5.h
+include/nbcompat/nbconfig.h
+include/nbcompat/nbtypes.h
+include/nbcompat/poll.h
+include/nbcompat/rmd160.h
+include/nbcompat/sha1.h
+include/nbcompat/sha2.h
+include/nbcompat/statfs.h
+include/nbcompat/vis.h
lib/libnbcompat.a
-@dirrm include/libnbcompat/nbcompat
-@dirrm include/libnbcompat
+@dirrm include/nbcompat
@unexec ${RMDIR} -p %D/include 2>/dev/null || ${TRUE}
@unexec ${RMDIR} -p %D/lib 2>/dev/null || ${TRUE}
diff --git a/pkgtools/libnbcompat/buildlink2.mk b/pkgtools/libnbcompat/buildlink2.mk
index e1cbd465ecb..147fc119e59 100644
--- a/pkgtools/libnbcompat/buildlink2.mk
+++ b/pkgtools/libnbcompat/buildlink2.mk
@@ -1,9 +1,9 @@
-# $NetBSD: buildlink2.mk,v 1.11 2003/09/04 01:51:15 jlam Exp $
+# $NetBSD: buildlink2.mk,v 1.12 2003/09/05 18:35:58 jlam Exp $
.if !defined(LIBNBCOMPAT_BUILDLINK2_MK)
LIBNBCOMPAT_BUILDLINK2_MK= # defined
-BUILDLINK_DEPENDS.libnbcompat?= libnbcompat>=20030828
+BUILDLINK_DEPENDS.libnbcompat?= libnbcompat>=20030829
BUILDLINK_PKGSRCDIR.libnbcompat?= ../../pkgtools/libnbcompat
BUILDLINK_DEPMETHOD.libnbcompat?= build
@@ -11,12 +11,10 @@ BUILDLINK_PACKAGES+= libnbcompat
EVAL_PREFIX+= BUILDLINK_PREFIX.libnbcompat=libnbcompat
BUILDLINK_PREFIX.libnbcompat_DEFAULT= ${LOCALBASE}
-BUILDLINK_FILES.libnbcompat= include/libnbcompat/*/*
-BUILDLINK_FILES.libnbcompat+= include/libnbcompat/*
+BUILDLINK_FILES.libnbcompat= include/nbcompat.h
+BUILDLINK_FILES.libnbcompat+= include/nbcompat/*
BUILDLINK_FILES.libnbcompat+= lib/libnbcompat.*
-BUILDLINK_CPPFLAGS.libnbcompat= \
- -I${BUILDLINK_PREFIX.libnbcompat}/include/libnbcompat
BUILDLINK_LDADD.libnbcompat= -lnbcompat
BUILDLINK_TARGETS+= libnbcompat-buildlink
@@ -24,8 +22,6 @@ BUILDLINK_TARGETS+= libnbcompat-buildlink
libnbcompat-buildlink: _BUILDLINK_USE
.if defined(GNU_CONFIGURE)
-CPPFLAGS+= ${BUILDLINK_CPPFLAGS.libnbcompat}
-CFLAGS+= ${BUILDLINK_CPPFLAGS.libnbcompat}
LIBS+= ${BUILDLINK_LDADD.libnbcompat}
.endif
diff --git a/pkgtools/libnbcompat/files/Makefile.in b/pkgtools/libnbcompat/files/Makefile.in
index 26ddc736c73..dac8738db33 100644
--- a/pkgtools/libnbcompat/files/Makefile.in
+++ b/pkgtools/libnbcompat/files/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.14 2003/09/03 16:38:38 jlam Exp $
+# $NetBSD: Makefile.in,v 1.15 2003/09/05 18:35:58 jlam Exp $
#
srcdir= @srcdir@
@@ -19,16 +19,12 @@ RANLIB= @RANLIB@
LIB= libnbcompat.a
-INCS= extern.h ftpglob.h getopt.h md5.h mtree.h nbcompat.h \
- nbcompat/err.h nbcompat/fts.h nbcompat/nbtypes.h \
- nbcompat/poll.h nbcompat/statfs.h nbcompat/vis.h \
- pack_dev.h pwcache.h rmd160.h sha1.h sha2.h stat_flags.h \
- util.h
+INCS= nbcompat.h nbcompat/err.h nbcompat/fts.h nbcompat/getopt.h \
+ nbcompat/glob.h nbcompat/md5.h nbcompat/nbtypes.h \
+ nbcompat/poll.h nbcompat/rmd160.h nbcompat/sha1.h \
+ nbcompat/sha2.h nbcompat/statfs.h nbcompat/vis.h
-OBJS= @LIBOBJS@ \
- md5c.o md5hl.o rmd160.o rmd160hl.o sha1.o sha1hl.o \
- sha2.o sha2hl.o setmode.o getid.o misc.o pack_dev.o \
- spec.o setmode.o stat_flags.o pwcache.o getopt_long.o
+OBJS= @LIBOBJS@
LINK= $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
COMPILE= $(CC) $(CPPFLAGS) $(CFLAGS)
@@ -73,13 +69,13 @@ install:
$(INSTALL) -m 755 -d $(prefix)/lib
$(INSTALL) -m 555 ${LIB} $(prefix)/lib
$(RANLIB) $(prefix)/lib/$(LIB)
- $(INSTALL) -m 755 -d $(prefix)/include/libnbcompat
- $(INSTALL) -m 755 -d $(prefix)/include/libnbcompat/nbcompat
+ $(INSTALL) -m 755 -d $(prefix)/include
+ $(INSTALL) -m 755 -d $(prefix)/include/nbcompat
@for file in $(INCS); do \
- echo "$(INSTALL) -m 444 $$file $(prefix)/include/libnbcompat/$$file"; \
- $(INSTALL) -m 444 $$file $(prefix)/include/libnbcompat/$$file; \
+ echo "$(INSTALL) -m 444 $$file $(prefix)/include/$$file"; \
+ $(INSTALL) -m 444 $$file $(prefix)/include/$$file; \
done
- $(INSTALL) -m 444 nbcompat/nbconfig.hi $(prefix)/include/libnbcompat/nbcompat/nbconfig.h
+ $(INSTALL) -m 444 nbcompat/nbconfig.hi $(prefix)/include/nbcompat/nbconfig.h
clean:
rm -f *.a *.o bits nbcompat/nbtypes.h nbcompat/nbcompat.hi
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index f5e3d25ade8..30a9a7baa55 100755
--- a/pkgtools/libnbcompat/files/configure
+++ b/pkgtools/libnbcompat/files/configure
@@ -3166,8 +3166,10 @@ 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 fts.h getopt.h glob.h inttypes.h libutil.h limits.h \
machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \
paths.h poll.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 \
@@ -3316,6 +3318,152 @@ fi
done
+
+
+
+
+for ac_header in md5.h rmd160.h sha1.h sha2.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
+#line $LINENO "configure"
+/* 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>&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.$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
+#line $LINENO "configure"
+/* 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
+ 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 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 preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ 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: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.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
+
+
pkg_use_nbcompat_vis=yes
if test "${ac_cv_header_vis_h+set}" = set; then
echo "$as_me:$LINENO: checking for vis.h" >&5
@@ -5759,11 +5907,11 @@ done
-for ac_func in err fgetln fparseln fseeko getenv glob inet_ntop \
- inet_pton isblank lchflags lchmod lchown lutimes mkstemp \
- mkdtemp poll setenv setprogname snprintf strdup strerror \
- strlcat strlcpy strmode strptime strsep strtoll timegm \
- usleep
+
+for ac_func in err fgetln fparseln fseeko getenv getopt_long glob \
+ inet_ntop inet_pton isblank lchflags lchmod lchown lutimes mkstemp \
+ mkdtemp poll setenv setprogname snprintf strdup strerror strlcat \
+ strlcpy strmode strptime strsep strtoll timegm usleep
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -5853,7 +6001,8 @@ done
-for ac_func in MD5File RMD160File SHA1File
+
+for ac_func in setgroupent setgrent setpassent setpwent
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -5940,7 +6089,8 @@ done
-for ac_func in setgroupent setgrent setpassent setpwent
+
+for ac_func in bcopy bzero memset memcpy setlocale
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -6025,10 +6175,7 @@ done
-
-
-
-for ac_func in bcopy bzero memset memcpy setlocale
+for ac_func in getmode setmode
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -6107,13 +6254,25 @@ 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
fi
done
+if test $pkg_use_nbcompat_setmode = yes; then
+ LIBOBJS="$LIBOBJS setmode.$ac_objext"
+fi
-for ac_func in getmode setmode
+
+
+
+
+
+
+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
@@ -6192,23 +6351,99 @@ 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
fi
done
+if test $pkg_use_nbcompat_setmode = yes; then
+ LIBOBJS="$LIBOBJS pwcache.$ac_objext"
+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
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* 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
+/* 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>&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.$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
+ LIBOBJS="$LIBOBJS __fts13.$ac_objext"
+fi
-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
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+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
@@ -6219,7 +6454,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
+ 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__
@@ -6234,14 +6469,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 $ac_func ();
+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_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_MD5File) || defined (__stub___MD5File)
choke me
#else
-char (*f) () = $ac_func;
+char (*f) () = MD5File;
#endif
#ifdef __cplusplus
}
@@ -6250,7 +6485,7 @@ char (*f) () = $ac_func;
int
main ()
{
-return f != $ac_func;
+return f != MD5File;
;
return 0;
}
@@ -6267,32 +6502,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ ac_cv_func_MD5File=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+ac_cv_func_MD5File=no
fi
rm -f 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
+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
-fi
-done
+ LIBOBJS="$LIBOBJS md5c.$ac_objext"
+ LIBOBJS="$LIBOBJS md5hl.$ac_objext"
+fi
-for ac_func in fts_open
-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 "$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
@@ -6303,7 +6535,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
+ 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__
@@ -6318,14 +6550,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 $ac_func ();
+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_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_RMD160File) || defined (__stub___RMD160File)
choke me
#else
-char (*f) () = $ac_func;
+char (*f) () = RMD160File;
#endif
#ifdef __cplusplus
}
@@ -6334,7 +6566,7 @@ char (*f) () = $ac_func;
int
main ()
{
-return f != $ac_func;
+return f != RMD160File;
;
return 0;
}
@@ -6351,37 +6583,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ ac_cv_func_RMD160File=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+ac_cv_func_RMD160File=no
fi
rm -f 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
- :
+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
- LIBOBJS="$LIBOBJS __fts13.$ac_objext"
-fi
-done
-
-
+ LIBOBJS="$LIBOBJS rmd160.$ac_objext"
+ LIBOBJS="$LIBOBJS rmd160hl.$ac_objext"
+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 "$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
@@ -6392,7 +6616,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
+ 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__
@@ -6407,14 +6631,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 $ac_func ();
+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_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_SHA1File) || defined (__stub___SHA1File)
choke me
#else
-char (*f) () = $ac_func;
+char (*f) () = SHA1File;
#endif
#ifdef __cplusplus
}
@@ -6423,7 +6647,7 @@ char (*f) () = $ac_func;
int
main ()
{
-return f != $ac_func;
+return f != SHA1File;
;
return 0;
}
@@ -6440,45 +6664,112 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
+ ac_cv_func_SHA1File=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+ac_cv_func_SHA1File=no
fi
rm -f 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
+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
- pkg_use_nbcompat_vis=yes
+
+ LIBOBJS="$LIBOBJS sha1.$ac_objext"
+ LIBOBJS="$LIBOBJS sha1hl.$ac_objext"
+
fi
-done
+echo "$as_me:$LINENO: checking for SHA256_File" >&5
+echo $ECHO_N "checking for SHA256_File... $ECHO_C" >&6
+if test "${ac_cv_func_SHA256_File+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char SHA256_File (); 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
+/* 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 SHA256_File ();
+/* 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_SHA256_File) || defined (__stub___SHA256_File)
+choke me
+#else
+char (*f) () = SHA256_File;
+#endif
+#ifdef __cplusplus
+}
+#endif
-if test $pkg_use_nbcompat_vis = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_NBCOMPAT_VIS 1
+int
+main ()
+{
+return f != SHA256_File;
+ ;
+ return 0;
+}
_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 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_SHA256_File=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_cv_func_SHA256_File=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_SHA256_File" >&5
+echo "${ECHO_T}$ac_cv_func_SHA256_File" >&6
+if test $ac_cv_func_SHA256_File = yes; then
+ :
+else
+ LIBOBJS="$LIBOBJS sha2.$ac_objext"
+ LIBOBJS="$LIBOBJS sha2hl.$ac_objext"
- LIBOBJS="$LIBOBJS vis.$ac_objext"
- LIBOBJS="$LIBOBJS unvis.$ac_objext"
fi
-
-for ac_func in getpassphrase getpgrp memmove poll select
+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
@@ -6557,12 +6848,30 @@ 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
fi
done
-for ac_func in getopt_long
+if test $pkg_use_nbcompat_vis = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_NBCOMPAT_VIS 1
+_ACEOF
+
+
+
+ LIBOBJS="$LIBOBJS vis.$ac_objext"
+ LIBOBJS="$LIBOBJS unvis.$ac_objext"
+fi
+
+
+
+
+
+
+for ac_func in getpassphrase getpgrp memmove poll select
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index 11f0ca88a16..1c93a90e2e7 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -31,7 +31,7 @@ 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 fts.h getopt.h glob.h inttypes.h libutil.h limits.h \
machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \
paths.h poll.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 \
@@ -40,6 +40,8 @@ AC_CHECK_HEADERS([arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \
sys/stat.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([md5.h rmd160.h sha1.h sha2.h])
+
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.
@@ -82,19 +84,46 @@ AC_FUNC_MALLOC
AC_FUNC_STRERROR_R
AC_FUNC_VPRINTF
-AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv glob inet_ntop \
- inet_pton isblank lchflags lchmod lchown lutimes mkstemp \
- mkdtemp poll setenv setprogname snprintf strdup strerror \
- strlcat strlcpy strmode strptime strsep strtoll timegm \
- usleep])
+AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv getopt_long glob \
+ inet_ntop inet_pton isblank lchflags lchmod lchown lutimes mkstemp \
+ mkdtemp poll setenv setprogname snprintf strdup strerror strlcat \
+ strlcpy strmode strptime strsep strtoll timegm usleep])
-AC_CHECK_FUNCS([MD5File RMD160File SHA1File])
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])
+
+if test $pkg_use_nbcompat_setmode = yes; then
+ AC_LIBOBJ(setmode)
+fi
+
AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \
- uid_from_user user_from_uid])
-AC_CHECK_FUNCS(fts_open, [:], [AC_LIBOBJ(__fts13)])
+ uid_from_user user_from_uid],
+ [pkg_use_nbcompat_pwcache=no], [pkg_use_nbcompat_pwcache=yes])
+
+if test $pkg_use_nbcompat_setmode = yes; then
+ AC_LIBOBJ(pwcache)
+fi
+
+AC_CHECK_FUNC(fts_open, [:], [AC_LIBOBJ(__fts13)])
+
+AC_CHECK_FUNC(MD5File, [:], [
+ AC_LIBOBJ(md5c)
+ AC_LIBOBJ(md5hl)
+])
+AC_CHECK_FUNC(RMD160File, [:], [
+ AC_LIBOBJ(rmd160)
+ AC_LIBOBJ(rmd160hl)
+])
+AC_CHECK_FUNC(SHA1File, [:], [
+ AC_LIBOBJ(sha1)
+ AC_LIBOBJ(sha1hl)
+])
+AC_CHECK_FUNC(SHA256_File, [:], [
+ AC_LIBOBJ(sha2)
+ AC_LIBOBJ(sha2hl)
+])
AC_CHECK_FUNCS([strunvis strvis strsvis],
[pkg_use_nbcompat_vis=no],
@@ -110,7 +139,6 @@ if test $pkg_use_nbcompat_vis = yes; then
fi
AC_CHECK_FUNCS([getpassphrase getpgrp memmove poll select])
-AC_CHECK_FUNCS([getopt_long])
AC_CHECK_FUNC(getpgrp, [AC_FUNC_GETPGRP])
diff --git a/pkgtools/libnbcompat/files/extern.h b/pkgtools/libnbcompat/files/extern.h
deleted file mode 100644
index 9d726defcee..00000000000
--- a/pkgtools/libnbcompat/files/extern.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $NetBSD: extern.h,v 1.5 2003/09/03 13:11:14 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.
- *
- * @(#)extern.h 8.1 (Berkeley) 6/6/93
- */
-
-#include <nbcompat.h>
-
-#include <mtree.h>
-
-#ifdef __NetBSD__
-#define HAVE_STRUCT_STAT_ST_FLAGS 1
-#endif
-
-#if HAVE_ERR_H
-#include <err.h>
-#endif
-
-#if HAVE_FTS_H
-#include <fts.h>
-#endif
-
-#if HAVE_VIS_H
-#include <vis.h>
-#endif
-
-#if HAVE_NETDB_H
-/* For MAXHOSTNAMELEN on some platforms. */
-#include <netdb.h>
-#endif
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif
-
-#ifndef HAVE_STRSEP
-char *strsep(char **, const char *);
-#endif
-
-#ifndef HAVE_USER_FROM_UID
-char *user_from_uid(uid_t, int);
-#endif
-
-#ifndef HAVE_GROUP_FROM_GID
-char *group_from_gid(gid_t, int);
-#endif
-
-#ifndef HAVE_GETMODE
-mode_t getmode(const void *, mode_t);
-#endif
-
-#ifndef HAVE_SETMODE
-void *setmode(const char *);
-#endif
-
-void addtag(slist_t *, char *);
-int check_excludes(const char *, const char *);
-int compare(NODE *, FTSENT *);
-int crc(int, u_int32_t *, u_int32_t *);
-void cwalk(void);
-void dump_nodes(const char *, NODE *, int);
-void init_excludes(void);
-int matchtags(NODE *);
-void mtree_err(const char *, ...)
- __attribute__((__format__(__printf__, 1, 2)));
-const char *nodetype(u_int);
-u_int parsekey(const char *, int *);
-void parsetags(slist_t *, char *);
-u_int parsetype(const char *);
-void read_excludes_file(const char *);
-const char *rlink(const char *);
-int verify(void);
-
-extern int dflag, eflag, iflag, lflag, mflag, rflag, sflag, tflag, uflag;
-extern int Wflag;
-extern size_t mtree_lineno;
-extern u_int32_t crc_total;
-extern int ftsoptions, keys;
-extern char fullpath[];
-extern slist_t includetags, excludetags;
-
-
-#include <stat_flags.h>
diff --git a/pkgtools/libnbcompat/files/getid.c b/pkgtools/libnbcompat/files/getid.c
deleted file mode 100644
index 403bbc28ba8..00000000000
--- a/pkgtools/libnbcompat/files/getid.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/* $NetBSD: getid.c,v 1.2 2003/08/27 12:25:40 jmmv Exp $ */
-/* from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */
-/* from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */
-
-/*
- * Copyright (c) 1987, 1988, 1989, 1993, 1994, 1995
- * 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.
- */
-
-/*-
- * Copyright (c) 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Luke Mewburn of Wasabi Systems.
- *
- * 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 <sys/param.h>
-#include <sys/time.h>
-
-#include <grp.h>
-#include <limits.h>
-#include <pwd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "extern.h"
-
-#ifndef linux
-static struct group * gi_getgrnam(const char *);
-static struct group * gi_getgrgid(gid_t);
-static int gi_setgroupent(int);
-static int grscan(int, gid_t, const char *);
-static int grmatchline(int, gid_t, const char *);
-#endif
-static void gi_endgrent(void);
-static int grstart(void);
-
-#ifndef linux
-static struct passwd * gi_getpwnam(const char *);
-static struct passwd * gi_getpwuid(uid_t);
-static int gi_setpassent(int);
-static int pwscan(int, uid_t, const char *);
-static int pwmatchline(int, uid_t, const char *);
-#endif
-static void gi_endpwent(void);
-static int pwstart(void);
-
-#define MAXGRP 200
-#define MAXLINELENGTH 1024
-
-static FILE *_gr_fp;
-#ifndef linux
-static struct group _gr_group;
-static int _gr_stayopen;
-#endif
-static int _gr_filesdone;
-static FILE *_pw_fp;
-#ifndef linux
-static struct passwd _pw_passwd; /* password structure */
-static int _pw_stayopen; /* keep fd's open */
-#endif
-static int _pw_filesdone;
-
-static char grfile[MAXPATHLEN];
-static char pwfile[MAXPATHLEN];
-
-#ifndef linux
-static char *members[MAXGRP];
-static char grline[MAXLINELENGTH];
-static char pwline[MAXLINELENGTH];
-#endif
-
-#ifndef GID_MAX
-#define GID_MAX 2147483647U /* max value for a gid_t (2^31-2) */
-#endif
-
-#ifndef UID_MAX
-#define UID_MAX 2147483647U /* max value for a uid_t (2^31-2) */
-#endif
-
-int
-setup_getid(const char *dir)
-{
- if (dir == NULL)
- return (0);
-
- /* close existing databases */
- gi_endgrent();
- gi_endpwent();
-
- /* build paths to new databases */
- snprintf(grfile, sizeof(grfile), "%s/group", dir);
- snprintf(pwfile, sizeof(pwfile), "%s/master.passwd", dir);
-
- /* try to open new databases */
- if (!grstart() || !pwstart())
- return (0);
-
-#ifdef netbsd
- /* switch pwcache(3) lookup functions */
- if (pwcache_groupdb(gi_setgroupent, gi_endgrent,
- gi_getgrnam, gi_getgrgid) == -1
- || pwcache_userdb(gi_setpassent, gi_endpwent,
- gi_getpwnam, gi_getpwuid) == -1)
- return (0);
-#endif
-
- return (1);
-}
-
-
-/*
- * group lookup functions
- */
-
-#ifndef linux
-static struct group *
-gi_getgrnam(const char *name)
-{
- int rval;
-
- if (!grstart())
- return NULL;
- rval = grscan(1, 0, name);
- if (!_gr_stayopen)
- endgrent();
- return (rval) ? &_gr_group : NULL;
-}
-
-static struct group *
-gi_getgrgid(gid_t gid)
-{
- int rval;
-
- if (!grstart())
- return NULL;
- rval = grscan(1, gid, NULL);
- if (!_gr_stayopen)
- endgrent();
- return (rval) ? &_gr_group : NULL;
-}
-
-static int
-gi_setgroupent(int stayopen)
-{
-
- if (!grstart())
- return 0;
- _gr_stayopen = stayopen;
- return 1;
-}
-#endif
-
-static void
-gi_endgrent(void)
-{
-
- _gr_filesdone = 0;
- if (_gr_fp) {
- (void)fclose(_gr_fp);
- _gr_fp = NULL;
- }
-}
-
-static int
-grstart(void)
-{
-
- _gr_filesdone = 0;
- if (_gr_fp) {
- rewind(_gr_fp);
- return 1;
- }
- if (grfile[0] == '\0') /* sanity check */
- return 0;
- return (_gr_fp = fopen(grfile, "r")) ? 1 : 0;
-}
-
-#ifndef linux
-static int
-grscan(int search, gid_t gid, const char *name)
-{
-
- if (_gr_filesdone)
- return 0;
- for (;;) {
- if (!fgets(grline, sizeof(grline), _gr_fp)) {
- if (!search)
- _gr_filesdone = 1;
- return 0;
- }
- /* skip lines that are too big */
- if (!strchr(grline, '\n')) {
- int ch;
-
- while ((ch = getc(_gr_fp)) != '\n' && ch != EOF)
- ;
- continue;
- }
- if (grmatchline(search, gid, name))
- return 1;
- }
- /* NOTREACHED */
-}
-
-static int
-grmatchline(int search, gid_t gid, const char *name)
-{
- unsigned long id;
- char **m;
- char *cp, *bp, *ep;
-
- /* name may be NULL if search is nonzero */
-
- bp = grline;
- memset(&_gr_group, 0, sizeof(_gr_group));
- _gr_group.gr_name = strsep(&bp, ":\n");
- if (search && name && strcmp(_gr_group.gr_name, name))
- return 0;
- _gr_group.gr_passwd = strsep(&bp, ":\n");
- if (!(cp = strsep(&bp, ":\n")))
- return 0;
- id = strtoul(cp, &ep, 10);
- if (id > GID_MAX || *ep != '\0')
- return 0;
- _gr_group.gr_gid = (gid_t)id;
- if (search && name == NULL && _gr_group.gr_gid != gid)
- return 0;
- cp = NULL;
- if (bp == NULL)
- return 0;
- for (_gr_group.gr_mem = m = members;; bp++) {
- if (m == &members[MAXGRP - 1])
- break;
- if (*bp == ',') {
- if (cp) {
- *bp = '\0';
- *m++ = cp;
- cp = NULL;
- }
- } else if (*bp == '\0' || *bp == '\n' || *bp == ' ') {
- if (cp) {
- *bp = '\0';
- *m++ = cp;
- }
- break;
- } else if (cp == NULL)
- cp = bp;
- }
- *m = NULL;
- return 1;
-}
-#endif
-
-
-/*
- * user lookup functions
- */
-
-#ifndef linux
-static struct passwd *
-gi_getpwnam(const char *name)
-{
- int rval;
-
- if (!pwstart())
- return NULL;
- rval = pwscan(1, 0, name);
- if (!_pw_stayopen)
- endpwent();
- return (rval) ? &_pw_passwd : NULL;
-}
-
-static struct passwd *
-gi_getpwuid(uid_t uid)
-{
- int rval;
-
- if (!pwstart())
- return NULL;
- rval = pwscan(1, uid, NULL);
- if (!_pw_stayopen)
- endpwent();
- return (rval) ? &_pw_passwd : NULL;
-}
-
-static int
-gi_setpassent(int stayopen)
-{
-
- if (!pwstart())
- return 0;
- _pw_stayopen = stayopen;
- return 1;
-}
-#endif
-
-static void
-gi_endpwent(void)
-{
-
- _pw_filesdone = 0;
- if (_pw_fp) {
- (void)fclose(_pw_fp);
- _pw_fp = NULL;
- }
-}
-
-static int
-pwstart(void)
-{
-
- _pw_filesdone = 0;
- if (_pw_fp) {
- rewind(_pw_fp);
- return 1;
- }
- if (pwfile[0] == '\0') /* sanity check */
- return 0;
- return (_pw_fp = fopen(pwfile, "r")) ? 1 : 0;
-}
-
-
-#ifndef linux
-static int
-pwscan(int search, uid_t uid, const char *name)
-{
-
- if (_pw_filesdone)
- return 0;
- for (;;) {
- if (!fgets(pwline, sizeof(pwline), _pw_fp)) {
- if (!search)
- _pw_filesdone = 1;
- return 0;
- }
- /* skip lines that are too big */
- if (!strchr(pwline, '\n')) {
- int ch;
-
- while ((ch = getc(_pw_fp)) != '\n' && ch != EOF)
- ;
- continue;
- }
- if (pwmatchline(search, uid, name))
- return 1;
- }
- /* NOTREACHED */
-}
-
-static int
-pwmatchline(int search, uid_t uid, const char *name)
-{
- unsigned long id;
- char *cp, *bp, *ep;
-
- /* name may be NULL if search is nonzero */
-
- bp = pwline;
- memset(&_pw_passwd, 0, sizeof(_pw_passwd));
- _pw_passwd.pw_name = strsep(&bp, ":\n"); /* name */
- if (search && name && strcmp(_pw_passwd.pw_name, name))
- return 0;
-
- _pw_passwd.pw_passwd = strsep(&bp, ":\n"); /* passwd */
-
- if (!(cp = strsep(&bp, ":\n"))) /* uid */
- return 0;
- id = strtoul(cp, &ep, 10);
- if (id > UID_MAX || *ep != '\0')
- return 0;
- _pw_passwd.pw_uid = (uid_t)id;
- if (search && name == NULL && _pw_passwd.pw_uid != uid)
- return 0;
-
- if (!(cp = strsep(&bp, ":\n"))) /* gid */
- return 0;
- id = strtoul(cp, &ep, 10);
- if (id > GID_MAX || *ep != '\0')
- return 0;
- _pw_passwd.pw_gid = (gid_t)id;
-
- if (!(ep = strsep(&bp, ":"))) /* class */
- return 0;
- if (!(ep = strsep(&bp, ":"))) /* change */
- return 0;
- if (!(ep = strsep(&bp, ":"))) /* expire */
- return 0;
-
- if (!(_pw_passwd.pw_gecos = strsep(&bp, ":\n"))) /* gecos */
- return 0;
- if (!(_pw_passwd.pw_dir = strsep(&bp, ":\n"))) /* directory */
- return 0;
- if (!(_pw_passwd.pw_shell = strsep(&bp, ":\n"))) /* shell */
- return 0;
-
- if (strchr(bp, ':') != NULL)
- return 0;
-
- return 1;
-}
-#endif
diff --git a/pkgtools/libnbcompat/files/md5c.c b/pkgtools/libnbcompat/files/md5c.c
index 17701e7ad5c..7362e6e2a23 100644
--- a/pkgtools/libnbcompat/files/md5c.c
+++ b/pkgtools/libnbcompat/files/md5c.c
@@ -1,4 +1,4 @@
-/* $NetBSD: md5c.c,v 1.3 2003/09/03 13:11:14 jlam Exp $ */
+/* $NetBSD: md5c.c,v 1.4 2003/09/05 18:36:01 jlam Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
@@ -44,7 +44,7 @@
/* #include "namespace.h" */
#include <assert.h>
#include <string.h>
-#include <md5.h>
+#include "nbcompat/md5.h"
#endif /* _KERNEL || _STANDALONE */
#if defined(HAVE_MEMSET)
diff --git a/pkgtools/libnbcompat/files/md5hl.c b/pkgtools/libnbcompat/files/md5hl.c
index 48c2dca0cc3..6e1985fca38 100644
--- a/pkgtools/libnbcompat/files/md5hl.c
+++ b/pkgtools/libnbcompat/files/md5hl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: md5hl.c,v 1.3 2003/09/03 13:11:14 jlam Exp $ */
+/* $NetBSD: md5hl.c,v 1.4 2003/09/05 18:36:01 jlam Exp $ */
/*
* Written by Jason R. Thorpe <thorpej@netbsd.org>, April 29, 1997.
@@ -14,13 +14,13 @@
#define MDALGORITHM MD5
-#include <md5.h>
+#include "nbcompat/md5.h"
#ifndef _DIAGASSERT
#define _DIAGASSERT(cond) assert(cond)
#endif
-/* $NetBSD: md5hl.c,v 1.3 2003/09/03 13:11:14 jlam Exp $ */
+/* $NetBSD: md5hl.c,v 1.4 2003/09/05 18:36:01 jlam Exp $ */
/*
* ----------------------------------------------------------------------------
diff --git a/pkgtools/libnbcompat/files/misc.c b/pkgtools/libnbcompat/files/misc.c
deleted file mode 100644
index 01fab468247..00000000000
--- a/pkgtools/libnbcompat/files/misc.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* $NetBSD: misc.c,v 1.2 2003/08/27 12:25:40 jmmv 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. 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.
- *
- * @(#)misc.c 8.1 (Berkeley) 6/6/93
- */
-
-#include "nbcompat.h"
-
-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
-
-#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: misc.c,v 1.2 2003/08/27 12:25:40 jmmv Exp $");
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "extern.h"
-
-typedef struct _key {
- const char *name; /* key name */
- u_int val; /* value */
-
-#define NEEDVALUE 0x01
- u_int flags;
-} KEY;
-
-/* NB: the following tables must be sorted lexically. */
-static KEY keylist[] = {
- {"cksum", F_CKSUM, NEEDVALUE},
- {"device", F_DEV, NEEDVALUE},
- {"flags", F_FLAGS, NEEDVALUE},
- {"gid", F_GID, NEEDVALUE},
- {"gname", F_GNAME, NEEDVALUE},
- {"ignore", F_IGN, 0},
- {"link", F_SLINK, NEEDVALUE},
- {"md5", F_MD5, NEEDVALUE},
- {"md5digest", F_MD5, NEEDVALUE},
- {"mode", F_MODE, NEEDVALUE},
- {"nlink", F_NLINK, NEEDVALUE},
- {"optional", F_OPT, 0},
- {"rmd160", F_RMD160, NEEDVALUE},
- {"rmd160digest",F_RMD160, NEEDVALUE},
- {"sha1", F_SHA1, NEEDVALUE},
- {"sha1digest", F_SHA1, NEEDVALUE},
- {"size", F_SIZE, NEEDVALUE},
- {"tags", F_TAGS, NEEDVALUE},
- {"time", F_TIME, NEEDVALUE},
- {"type", F_TYPE, NEEDVALUE},
- {"uid", F_UID, NEEDVALUE},
- {"uname", F_UNAME, NEEDVALUE}
-};
-
-static KEY typelist[] = {
- {"block", F_BLOCK, },
- {"char", F_CHAR, },
- {"dir", F_DIR, },
- {"fifo", F_FIFO, },
- {"file", F_FILE, },
- {"link", F_LINK, },
- {"socket", F_SOCK, },
-};
-
-slist_t excludetags, includetags;
-int keys = KEYDEFAULT;
-
-
-int keycompare(const void *, const void *);
-
-u_int
-parsekey(const char *name, int *needvaluep)
-{
- static int allbits;
- KEY *k, tmp;
-
- if (allbits == 0) {
- int i;
-
- for (i = 0; i < sizeof(keylist) / sizeof(KEY); i++)
- allbits |= keylist[i].val;
- }
- tmp.name = name;
- if (strcmp(name, "all") == 0)
- return (allbits);
- k = (KEY *)bsearch(&tmp, keylist, sizeof(keylist) / sizeof(KEY),
- sizeof(KEY), keycompare);
- if (k == NULL)
- mtree_err("unknown keyword `%s'", name);
-
- if (needvaluep)
- *needvaluep = k->flags & NEEDVALUE ? 1 : 0;
-
- return (k->val);
-}
-
-u_int
-parsetype(const char *name)
-{
- KEY *k, tmp;
-
- tmp.name = name;
- k = (KEY *)bsearch(&tmp, typelist, sizeof(typelist) / sizeof(KEY),
- sizeof(KEY), keycompare);
- if (k == NULL)
- mtree_err("unknown file type `%s'", name);
-
- return (k->val);
-}
-
-int
-keycompare(const void *a, const void *b)
-{
-
- return (strcmp(((const KEY *)a)->name, ((const KEY *)b)->name));
-}
-
-void
-mtree_err(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- if (mtree_lineno)
- warnx("failed at line %lu of the specification",
- (u_long) mtree_lineno);
- exit(1);
- /* NOTREACHED */
-}
-
-void
-addtag(slist_t *list, char *elem)
-{
-
-#define TAG_CHUNK 20
-
- if ((list->count % TAG_CHUNK) == 0) {
- char **new;
-
- new = (char **)realloc(list->list, (list->count + TAG_CHUNK)
- * sizeof(char *));
- if (new == NULL)
- mtree_err("memory allocation error");
- list->list = new;
- }
- list->list[list->count] = elem;
- list->count++;
-}
-
-void
-parsetags(slist_t *list, char *args)
-{
- char *p, *e;
- int len;
-
- if (args == NULL) {
- addtag(list, NULL);
- return;
- }
- while ((p = strsep(&args, ",")) != NULL) {
- if (*p == '\0')
- continue;
- len = strlen(p) + 3; /* "," + p + ",\0" */
- if ((e = malloc(len)) == NULL)
- mtree_err("memory allocation error");
- snprintf(e, len, ",%s,", p);
- addtag(list, e);
- }
-}
-
-/*
- * matchtags
- * returns 0 if there's a match from the exclude list in the node's tags,
- * or there's an include list and no match.
- * return 1 otherwise.
- */
-int
-matchtags(NODE *node)
-{
- int i;
-
- if (node->tags) {
- for (i = 0; i < excludetags.count; i++)
- if (strstr(node->tags, excludetags.list[i]))
- break;
- if (i < excludetags.count)
- return (0);
-
- for (i = 0; i < includetags.count; i++)
- if (strstr(node->tags, includetags.list[i]))
- break;
- if (i > 0 && i == includetags.count)
- return (0);
- } else if (includetags.count > 0) {
- return (0);
- }
- return (1);
-}
-
-u_int
-nodetoino(u_int type)
-{
-
- switch (type) {
- case F_BLOCK:
- return S_IFBLK;
- case F_CHAR:
- return S_IFCHR;
- case F_DIR:
- return S_IFDIR;
- case F_FIFO:
- return S_IFIFO;
- case F_FILE:
- return S_IFREG;
- case F_LINK:
- return S_IFLNK;
- case F_SOCK:
- return S_IFSOCK;
- default:
- printf("unknown type %d", type);
- abort();
- }
- /* NOTREACHED */
-}
-
-const char *
-nodetype(u_int type)
-{
-
- return (inotype(nodetoino(type)));
-}
-
-
-const char *
-inotype(u_int type)
-{
-
- switch (type & S_IFMT) {
- case S_IFBLK:
- return ("block");
- case S_IFCHR:
- return ("char");
- case S_IFDIR:
- return ("dir");
- case S_IFIFO:
- return ("fifo");
- case S_IFREG:
- return ("file");
- case S_IFLNK:
- return ("link");
- case S_IFSOCK:
- return ("socket");
- default:
- return ("unknown");
- }
- /* NOTREACHED */
-}
diff --git a/pkgtools/libnbcompat/files/mtree.h b/pkgtools/libnbcompat/files/mtree.h
deleted file mode 100644
index 517d703c4cd..00000000000
--- a/pkgtools/libnbcompat/files/mtree.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $NetBSD: mtree.h,v 1.1.1.1 2003/03/31 05:02:56 grant Exp $ */
-
-/*-
- * Copyright (c) 1990, 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.
- *
- * @(#)mtree.h 8.1 (Berkeley) 6/6/93
- */
-
-#ifndef _MTREE_H_
-#define _MTREE_H_
-
-#define KEYDEFAULT (F_GID | F_MODE | F_NLINK | F_SIZE | F_SLINK | \
- F_TIME | F_TYPE | F_UID | F_FLAGS)
-
-#define MISMATCHEXIT 2
-
-typedef struct _node {
- struct _node *parent, *child; /* up, down */
- struct _node *prev, *next; /* left, right */
- off_t st_size; /* size */
- struct timespec st_mtimespec; /* last modification time */
- char *slink; /* symbolic link reference */
- uid_t st_uid; /* uid */
- gid_t st_gid; /* gid */
-#if !defined(S_ISTXT) && defined(S_ISVTX)
-#define S_ISTXT S_ISVTX
-#endif
-#define MBITS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
- mode_t st_mode; /* mode */
- dev_t st_rdev; /* device type */
- u_long st_flags; /* flags */
- nlink_t st_nlink; /* link count */
- u_long cksum; /* check sum */
- char *md5digest; /* MD5 digest */
- char *rmd160digest; /* RMD-160 digest */
- char *sha1digest; /* SHA1 digest */
- char *tags; /* tags, comma delimited */
- size_t lineno; /* line # entry came from */
-
-#define F_CKSUM 0x00000001 /* cksum(1) check sum */
-#define F_DEV 0x00000002 /* device type */
-#define F_DONE 0x00000004 /* directory done */
-#define F_FLAGS 0x00000008 /* file flags */
-#define F_GID 0x00000010 /* gid */
-#define F_GNAME 0x00000020 /* group name */
-#define F_IGN 0x00000040 /* ignore */
-#define F_MAGIC 0x00000080 /* name has magic chars */
-#define F_MD5 0x00000100 /* MD5 digest */
-#define F_MODE 0x00000200 /* mode */
-#define F_NLINK 0x00000400 /* number of links */
-#define F_OPT 0x00000800 /* existence optional */
-#define F_RMD160 0x00001000 /* RMD-160 digest */
-#define F_SHA1 0x00002000 /* SHA1 digest */
-#define F_SIZE 0x00004000 /* size */
-#define F_SLINK 0x00008000 /* symbolic link */
-#define F_TAGS 0x00010000 /* tags */
-#define F_TIME 0x00020000 /* modification time */
-#define F_TYPE 0x00040000 /* file type */
-#define F_UID 0x00080000 /* uid */
-#define F_UNAME 0x00100000 /* user name */
-#define F_VISIT 0x00200000 /* file visited */
-
- int flags; /* items set */
-
-#define F_BLOCK 0x001 /* block special */
-#define F_CHAR 0x002 /* char special */
-#define F_DIR 0x004 /* directory */
-#define F_FIFO 0x008 /* fifo */
-#define F_FILE 0x010 /* regular file */
-#define F_LINK 0x020 /* symbolic link */
-#define F_SOCK 0x040 /* socket */
- int type; /* file type */
-
- char name[1]; /* file name (must be last) */
-} NODE;
-
-
-typedef struct {
- char **list;
- int count;
-} slist_t;
-
-
-/*
- * prototypes for functions published to other programs which want to use
- * the specfile parser but don't want to pull in all of "extern.h"
- */
-const char *inotype(u_int);
-u_int nodetoino(u_int);
-int setup_getid(const char *);
-NODE *spec(FILE *);
-char *vispath(const char *);
-
-
-#define RP(p) \
- ((p)->fts_path[0] == '.' && (p)->fts_path[1] == '/' ? \
- (p)->fts_path + 2 : (p)->fts_path)
-
-#define UF_MASK ((UF_NODUMP | UF_IMMUTABLE | \
- UF_APPEND | UF_OPAQUE) \
- & UF_SETTABLE) /* user settable flags */
-#define SF_MASK ((SF_ARCHIVED | SF_IMMUTABLE | \
- SF_APPEND) & SF_SETTABLE) /* root settable flags */
-#define CH_MASK (UF_MASK | SF_MASK) /* all settable flags */
-#define SP_FLGS (SF_IMMUTABLE | SF_APPEND) /* special flags */
-
-#endif /* _MTREE_H_ */
diff --git a/pkgtools/libnbcompat/files/nbcompat.h b/pkgtools/libnbcompat/files/nbcompat.h
index e26e99d999a..f8db3f21534 100644
--- a/pkgtools/libnbcompat/files/nbcompat.h
+++ b/pkgtools/libnbcompat/files/nbcompat.h
@@ -1,4 +1,4 @@
-/* $NetBSD: nbcompat.h,v 1.14 2003/09/03 13:11:14 jlam Exp $ */
+/* $NetBSD: nbcompat.h,v 1.15 2003/09/05 18:36:02 jlam Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -225,7 +225,11 @@ struct { \
# include <nbcompat/err.h>
#endif
-#include <ftpglob.h>
+#if HAVE_GLOB_H
+# include <glob.h>
+#else
+# include <nbcompat/glob.h>
+#endif
#if HAVE_SYS_MKDEV_H
# include <sys/mkdev.h>
@@ -316,6 +320,30 @@ void tputs(const char *, int, int (*)(int));
# include <libutil.h>
#endif
+#if HAVE_MD5_H
+# include <md5.h>
+#else
+# include <nbcompat/md5.h>
+#endif
+
+#if HAVE_RMD160_H
+# include <rmd160.h>
+#else
+# include <nbcompat/rmd160.h>
+#endif
+
+#if HAVE_SHA1_H
+# include <sha1.h>
+#else
+# include <nbcompat/sha1.h>
+#endif
+
+#if HAVE_SHA2_H
+# include <sha2.h>
+#else
+# include <nbcompat/sha2.h>
+#endif
+
#if HAVE_NBCOMPAT_VIS
# ifdef HAVE_VIS_H
# undef HAVE_VIS_H
@@ -328,6 +356,20 @@ void tputs(const char *, int, int (*)(int));
# include <nbcompat/vis.h>
#endif
+#if HAVE_GETOPT_H
+# include <getopt.h>
+#else
+# include <nbcompat/getopt.h>
+#endif
+
+#if !HAVE_OPTARG_D
+extern char *optarg;
+#endif
+
+#if !HAVE_OPTIND_D
+extern int optind;
+#endif
+
#if !HAVE_D_NAMLEN
# define DIRENT_MISSING_D_NAMLEN
#endif
@@ -349,14 +391,6 @@ int isblank(int);
char *getpass(const char *);
#endif
-#if !HAVE_OPTARG_D
-extern char *optarg;
-#endif
-
-#if !HAVE_OPTIND_D
-extern int optind;
-#endif
-
#if !HAVE_PCLOSE_D
int pclose(FILE *);
#endif
@@ -461,6 +495,22 @@ size_t strlcpy(char *, const char *, size_t);
char *strsep(char **stringp, const char *delim);
#endif
+#if !HAVE_USER_FROM_UID
+const char *user_from_uid(uid_t, int);
+#endif
+
+#if !HAVE_GROUP_FROM_GID
+const char *group_from_gid(gid_t, int);
+#endif
+
+#if !HAVE_UID_FROM_USER
+int uid_from_user(const char *, uid_t *);
+#endif
+
+#if !HAVE_GID_FROM_GROUP
+int gid_from_group(const char *, gid_t *);
+#endif
+
#if HAVE_NBCOMPAT_STATFS
# include <nbcompat/statfs.h>
#endif
diff --git a/pkgtools/libnbcompat/files/getopt.h b/pkgtools/libnbcompat/files/nbcompat/getopt.h
index ea2b61d12d9..819e4c53d27 100644
--- a/pkgtools/libnbcompat/files/getopt.h
+++ b/pkgtools/libnbcompat/files/nbcompat/getopt.h
@@ -1,4 +1,4 @@
-/* $NetBSD: getopt.h,v 1.3 2003/09/03 13:11:14 jlam Exp $ */
+/* $NetBSD: getopt.h,v 1.1 2003/09/05 18:36:07 jlam Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -39,8 +39,6 @@
#ifndef _GETOPT_H_
#define _GETOPT_H_
-#include <nbcompat.h>
-
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
diff --git a/pkgtools/libnbcompat/files/ftpglob.h b/pkgtools/libnbcompat/files/nbcompat/glob.h
index bd115026884..b913c94fcab 100644
--- a/pkgtools/libnbcompat/files/ftpglob.h
+++ b/pkgtools/libnbcompat/files/nbcompat/glob.h
@@ -1,5 +1,5 @@
-/* $Id: ftpglob.h,v 1.1.1.1 2003/03/31 05:02:45 grant Exp $ */
-/* $NetBSD: ftpglob.h,v 1.1.1.1 2003/03/31 05:02:45 grant Exp $ */
+/* $Id: glob.h,v 1.1 2003/09/05 18:36:07 jlam Exp $ */
+/* $NetBSD: glob.h,v 1.1 2003/09/05 18:36:07 jlam Exp $ */
/*
* Copyright (c) 1989, 1993
diff --git a/pkgtools/libnbcompat/files/md5.h b/pkgtools/libnbcompat/files/nbcompat/md5.h
index 21a5d147924..157bb7d4e02 100644
--- a/pkgtools/libnbcompat/files/md5.h
+++ b/pkgtools/libnbcompat/files/nbcompat/md5.h
@@ -1,4 +1,4 @@
-/* $NetBSD: md5.h,v 1.1.1.1 2003/03/31 05:02:55 grant Exp $ */
+/* $NetBSD: md5.h,v 1.1 2003/09/05 18:36:07 jlam Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
diff --git a/pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in b/pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in
index e4e15c768cf..23903d92e51 100644
--- a/pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in
@@ -52,15 +52,15 @@
/* Define to 1 if you have the <fts.h> header file. */
#undef HAVE_FTS_H
-/* Define to 1 if you have the `fts_open' function. */
-#undef HAVE_FTS_OPEN
-
/* Define to 1 if you have the `getenv' function. */
#undef HAVE_GETENV
/* Define to 1 if you have the `getmode' function. */
#undef HAVE_GETMODE
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
@@ -76,6 +76,9 @@
/* Define to 1 if you have the `glob' function. */
#undef HAVE_GLOB
+/* 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
@@ -134,8 +137,8 @@
to 0 otherwise. */
#undef HAVE_MALLOC
-/* Define to 1 if you have the `MD5File' function. */
-#undef HAVE_MD5FILE
+/* Define to 1 if you have the <md5.h> header file. */
+#undef HAVE_MD5_H
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
@@ -201,8 +204,8 @@
/* Define to 1 if `long long' is supported and sizeof(off_t) >= 8. */
#undef HAVE_QUAD_SUPPORT
-/* Define to 1 if you have the `RMD160File' function. */
-#undef HAVE_RMD160FILE
+/* Define to 1 if you have the <rmd160.h> header file. */
+#undef HAVE_RMD160_H
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
@@ -231,8 +234,11 @@
/* Define to 1 if you have the `setpwent' function. */
#undef HAVE_SETPWENT
-/* Define to 1 if you have the `SHA1File' function. */
-#undef HAVE_SHA1FILE
+/* Define to 1 if you have the <sha1.h> header file. */
+#undef HAVE_SHA1_H
+
+/* Define to 1 if you have the <sha2.h> header file. */
+#undef HAVE_SHA2_H
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
diff --git a/pkgtools/libnbcompat/files/rmd160.h b/pkgtools/libnbcompat/files/nbcompat/rmd160.h
index 27627840af4..c21303f15cf 100644
--- a/pkgtools/libnbcompat/files/rmd160.h
+++ b/pkgtools/libnbcompat/files/nbcompat/rmd160.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rmd160.h,v 1.1.1.1 2003/03/31 05:02:59 grant Exp $ */
+/* $NetBSD: rmd160.h,v 1.1 2003/09/05 18:36:08 jlam Exp $ */
/********************************************************************\
*
diff --git a/pkgtools/libnbcompat/files/sha1.h b/pkgtools/libnbcompat/files/nbcompat/sha1.h
index 2f2b1882021..342ecd7034d 100644
--- a/pkgtools/libnbcompat/files/sha1.h
+++ b/pkgtools/libnbcompat/files/nbcompat/sha1.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1.h,v 1.1.1.1 2003/03/31 05:03:00 grant Exp $ */
+/* $NetBSD: sha1.h,v 1.1 2003/09/05 18:36:08 jlam Exp $ */
/*
* SHA-1 in C
diff --git a/pkgtools/libnbcompat/files/sha2.h b/pkgtools/libnbcompat/files/nbcompat/sha2.h
index a0cc4e57d41..a0cc4e57d41 100644
--- a/pkgtools/libnbcompat/files/sha2.h
+++ b/pkgtools/libnbcompat/files/nbcompat/sha2.h
diff --git a/pkgtools/libnbcompat/files/pack_dev.c b/pkgtools/libnbcompat/files/pack_dev.c
deleted file mode 100644
index 0353ff74bd4..00000000000
--- a/pkgtools/libnbcompat/files/pack_dev.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $NetBSD: pack_dev.c,v 1.3 2003/09/03 13:11:14 jlam Exp $ */
-
-/*-
- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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
-
-#include "nbcompat/nbtypes.h"
-
-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
-
-#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: pack_dev.c,v 1.3 2003/09/03 13:11:14 jlam Exp $");
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#if HAVE_ERR_H
-#include <err.h>
-#endif
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#if HAVE_SYS_MKDEV_H
-#include <sys/mkdev.h>
-#endif
-
-#include "pack_dev.h"
-
-static pack_t pack_netbsd;
-static pack_t pack_freebsd;
-static pack_t pack_8_8;
-static pack_t pack_12_20;
-static pack_t pack_14_18;
-static pack_t pack_8_24;
-static pack_t pack_bsdos;
-static int compare_format(const void *, const void *);
-
-
- /* exported */
-dev_t
-pack_native(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev(numbers[0], numbers[1]);
- if (major(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_netbsd(x) ((int32_t)((((x) & 0x000fff00) >> 8)))
-#define minor_netbsd(x) ((int32_t)((((x) & 0xfff00000) >> 12) | \
- (((x) & 0x000000ff) >> 0)))
-#define makedev_netbsd(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \
- (((y) << 12) & 0xfff00000) | \
- (((y) << 0) & 0x000000ff)))
-
-static dev_t
-pack_netbsd(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_netbsd(numbers[0], numbers[1]);
- if (major_netbsd(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_netbsd(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_freebsd(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
-#define minor_freebsd(x) ((int32_t)(((x) & 0xffff00ff) >> 0))
-#define makedev_freebsd(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
- (((y) << 0) & 0xffff00ff)))
-
-static dev_t
-pack_freebsd(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_freebsd(numbers[0], numbers[1]);
- if (major_freebsd(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_freebsd(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_8_8(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
-#define minor_8_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
-#define makedev_8_8(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
- (((y) << 0) & 0x000000ff)))
-
-static dev_t
-pack_8_8(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_8_8(numbers[0], numbers[1]);
- if (major_8_8(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_8_8(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_12_20(x) ((int32_t)(((x) & 0xfff00000) >> 20))
-#define minor_12_20(x) ((int32_t)(((x) & 0x000fffff) >> 0))
-#define makedev_12_20(x,y) ((dev_t)((((x) << 20) & 0xfff00000) | \
- (((y) << 0) & 0x000fffff)))
-
-static dev_t
-pack_12_20(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_12_20(numbers[0], numbers[1]);
- if (major_12_20(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_12_20(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_14_18(x) ((int32_t)(((x) & 0xfffc0000) >> 18))
-#define minor_14_18(x) ((int32_t)(((x) & 0x0003ffff) >> 0))
-#define makedev_14_18(x,y) ((dev_t)((((x) << 18) & 0xfffc0000) | \
- (((y) << 0) & 0x0003ffff)))
-
-static dev_t
-pack_14_18(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_14_18(numbers[0], numbers[1]);
- if (major_14_18(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_14_18(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_8_24(x) ((int32_t)(((x) & 0xff000000) >> 24))
-#define minor_8_24(x) ((int32_t)(((x) & 0x00ffffff) >> 0))
-#define makedev_8_24(x,y) ((dev_t)((((x) << 24) & 0xff000000) | \
- (((y) << 0) & 0x00ffffff)))
-
-static dev_t
-pack_8_24(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_8_24(numbers[0], numbers[1]);
- if (major_8_24(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_8_24(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
-#define major_12_12_8(x) ((int32_t)(((x) & 0xfff00000) >> 20))
-#define unit_12_12_8(x) ((int32_t)(((x) & 0x000fff00) >> 8))
-#define subunit_12_12_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
-#define makedev_12_12_8(x,y,z) ((dev_t)((((x) << 20) & 0xfff00000) | \
- (((y) << 8) & 0x000fff00) | \
- (((z) << 0) & 0x000000ff)))
-
-static dev_t
-pack_bsdos(int n, u_long numbers[])
-{
- dev_t dev;
-
- if (n == 2) {
- dev = makedev_12_20(numbers[0], numbers[1]);
- if (major_12_20(dev) != numbers[0])
- errx(1, "invalid major number");
- if (minor_12_20(dev) != numbers[1])
- errx(1, "invalid minor number");
- } else if (n == 3) {
- dev = makedev_12_12_8(numbers[0], numbers[1], numbers[2]);
- if (major_12_12_8(dev) != numbers[0])
- errx(1, "invalid major number");
- if (unit_12_12_8(dev) != numbers[1])
- errx(1, "invalid unit number");
- if (subunit_12_12_8(dev) != numbers[2])
- errx(1, "invalid subunit number");
- } else
- errx(1, "too many fields for format");
- return (dev);
-}
-
-
- /* list of formats and pack functions */
- /* this list must be sorted lexically */
-struct format {
- const char *name;
- pack_t *pack;
-} formats[] = {
- {"386bsd", pack_8_8},
- {"4bsd", pack_8_8},
- {"bsdos", pack_bsdos},
- {"freebsd", pack_freebsd},
- {"hpux", pack_8_24},
- {"isc", pack_8_8},
- {"linux", pack_8_8},
- {"native", pack_native},
- {"netbsd", pack_netbsd},
- {"osf1", pack_12_20},
- {"sco", pack_8_8},
- {"solaris", pack_14_18},
- {"sunos", pack_8_8},
- {"svr3", pack_8_8},
- {"svr4", pack_14_18},
- {"ultrix", pack_8_8},
-};
-
-static int
-compare_format(const void *key, const void *element)
-{
- const char *name;
- const struct format *format;
-
- name = key;
- format = element;
-
- return (strcmp(name, format->name));
-}
-
-
-pack_t *
-pack_find(const char *name)
-{
- struct format *format;
-
- format = bsearch(name, formats,
- sizeof(formats)/sizeof(formats[0]),
- sizeof(formats[0]), compare_format);
- if (format == 0)
- return (NULL);
- return (format->pack);
-}
diff --git a/pkgtools/libnbcompat/files/pack_dev.h b/pkgtools/libnbcompat/files/pack_dev.h
deleted file mode 100644
index a586305649f..00000000000
--- a/pkgtools/libnbcompat/files/pack_dev.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: pack_dev.h,v 1.1.1.1 2003/03/31 05:02:57 grant Exp $ */
-
-/*-
- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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 _PACK_DEV_H
-#define _PACK_DEV_H
-
-typedef dev_t pack_t(int, u_long []);
-
-pack_t *pack_find(const char *);
-pack_t pack_native;
-
-#endif /* _PACK_DEV_H */
diff --git a/pkgtools/libnbcompat/files/rmd160.c b/pkgtools/libnbcompat/files/rmd160.c
index ea6bad60d82..1cee0aef08f 100644
--- a/pkgtools/libnbcompat/files/rmd160.c
+++ b/pkgtools/libnbcompat/files/rmd160.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rmd160.c,v 1.3 2003/09/03 13:11:15 jlam Exp $ */
+/* $NetBSD: rmd160.c,v 1.4 2003/09/05 18:36:03 jlam Exp $ */
/********************************************************************\
*
@@ -25,7 +25,7 @@
#include "nbcompat/nbtypes.h"
#ifndef lint
-__RCSID("$NetBSD: rmd160.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
+__RCSID("$NetBSD: rmd160.c,v 1.4 2003/09/05 18:36:03 jlam Exp $");
#endif /* not lint */
/* header files */
@@ -33,7 +33,7 @@ __RCSID("$NetBSD: rmd160.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
/* #include "namespace.h" */
#include <assert.h>
-#include <rmd160.h>
+#include "nbcompat/rmd160.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/pkgtools/libnbcompat/files/rmd160hl.c b/pkgtools/libnbcompat/files/rmd160hl.c
index a0a3cc06617..72dd0c0d99c 100644
--- a/pkgtools/libnbcompat/files/rmd160hl.c
+++ b/pkgtools/libnbcompat/files/rmd160hl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rmd160hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $ */
+/* $NetBSD: rmd160hl.c,v 1.4 2003/09/05 18:36:04 jlam Exp $ */
/* rmd160hl.c
* ----------------------------------------------------------------------------
@@ -18,7 +18,7 @@
#include "nbcompat/nbtypes.h"
#ifndef lint
-__RCSID("$NetBSD: rmd160hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
+__RCSID("$NetBSD: rmd160hl.c,v 1.4 2003/09/05 18:36:04 jlam Exp $");
#endif /* not lint */
@@ -31,7 +31,7 @@ __RCSID("$NetBSD: rmd160hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#include <rmd160.h>
+#include "nbcompat/rmd160.h"
#include <stdio.h>
#include <stdlib.h>
#if HAVE_UNISTD_H
diff --git a/pkgtools/libnbcompat/files/setmode.c b/pkgtools/libnbcompat/files/setmode.c
deleted file mode 100644
index a47b0f15224..00000000000
--- a/pkgtools/libnbcompat/files/setmode.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* $NetBSD: setmode.c,v 1.4 2003/09/03 13:11:15 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
- * Dave Borman at Cray Research, Inc.
- *
- * 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[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94";
-#else
-__RCSID("$NetBSD: setmode.c,v 1.4 2003/09/03 13:11:15 jlam Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#ifdef SETMODE_DEBUG
-#include <stdio.h>
-#endif
-
-#ifndef S_ISTXT
-#define S_ISTXT S_ISVTX
-#endif
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond) assert(cond)
-#endif
-
-#ifndef __ELF__
-#define _getmode getmode
-#define _setmode setmode
-#else
-#ifdef __weak_alias
-__weak_alias(getmode,_getmode)
-__weak_alias(setmode,_setmode)
-#endif
-#endif
-
-#define SET_LEN 6 /* initial # of bitcmd struct to malloc */
-#define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */
-
-typedef struct bitcmd {
- char cmd;
- char cmd2;
- mode_t bits;
-} BITCMD;
-
-#define CMD2_CLR 0x01
-#define CMD2_SET 0x02
-#define CMD2_GBITS 0x04
-#define CMD2_OBITS 0x08
-#define CMD2_UBITS 0x10
-
-static BITCMD *addcmd (BITCMD *, int, int, int, u_int);
-static void compress_mode (BITCMD *);
-#ifdef SETMODE_DEBUG
-static void dumpmode (BITCMD *);
-#endif
-
-#ifndef HAVE_GETMODE
-/*
- * Given the old mode and an array of bitcmd structures, apply the operations
- * described in the bitcmd structures to the old mode, and return the new mode.
- * Note that there is no '=' command; a strict assignment is just a '-' (clear
- * bits) followed by a '+' (set bits).
- */
-mode_t
-getmode(bbox, omode)
- const void *bbox;
- mode_t omode;
-{
- const BITCMD *set;
- mode_t clrval, newmode, value;
-
- _DIAGASSERT(bbox != NULL);
-
- set = (const BITCMD *)bbox;
- newmode = omode;
- for (value = 0;; set++)
- switch(set->cmd) {
- /*
- * When copying the user, group or other bits around, we "know"
- * where the bits are in the mode so that we can do shifts to
- * copy them around. If we don't use shifts, it gets real
- * grundgy with lots of single bit checks and bit sets.
- */
- case 'u':
- value = (newmode & S_IRWXU) >> 6;
- goto common;
-
- case 'g':
- value = (newmode & S_IRWXG) >> 3;
- goto common;
-
- case 'o':
- value = newmode & S_IRWXO;
-common: if (set->cmd2 & CMD2_CLR) {
- clrval =
- (set->cmd2 & CMD2_SET) ? S_IRWXO : value;
- if (set->cmd2 & CMD2_UBITS)
- newmode &= ~((clrval<<6) & set->bits);
- if (set->cmd2 & CMD2_GBITS)
- newmode &= ~((clrval<<3) & set->bits);
- if (set->cmd2 & CMD2_OBITS)
- newmode &= ~(clrval & set->bits);
- }
- if (set->cmd2 & CMD2_SET) {
- if (set->cmd2 & CMD2_UBITS)
- newmode |= (value<<6) & set->bits;
- if (set->cmd2 & CMD2_GBITS)
- newmode |= (value<<3) & set->bits;
- if (set->cmd2 & CMD2_OBITS)
- newmode |= value & set->bits;
- }
- break;
-
- case '+':
- newmode |= set->bits;
- break;
-
- case '-':
- newmode &= ~set->bits;
- break;
-
- case 'X':
- if (omode & (S_IFDIR|S_IXUSR|S_IXGRP|S_IXOTH))
- newmode |= set->bits;
- break;
-
- case '\0':
- default:
-#ifdef SETMODE_DEBUG
- (void)printf("getmode:%04o -> %04o\n", omode, newmode);
-#endif
- return (newmode);
- }
-}
-#endif /* HAVE_GETMODE */
-
-#ifndef HAVE_SETMODE
-#define ADDCMD(a, b, c, d) do { \
- if (set >= endset) { \
- BITCMD *newset; \
- setlen += SET_LEN_INCR; \
- newset = realloc(saveset, sizeof(BITCMD) * setlen); \
- if (newset == NULL) { \
- free(saveset); \
- return (NULL); \
- } \
- set = newset + (set - saveset); \
- saveset = newset; \
- endset = newset + (setlen - 2); \
- } \
- set = addcmd(set, (a), (b), (c), (d)); \
-} while (/*CONSTCOND*/0)
-
-#define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
-
-void *
-setmode(p)
- const char *p;
-{
- int perm, who;
- char op, *ep;
- BITCMD *set, *saveset, *endset;
- sigset_t sigset, sigoset;
- mode_t mask;
- int equalopdone = 0; /* pacify gcc */
- int permXbits, setlen;
-
- if (!*p)
- return (NULL);
-
- /*
- * Get a copy of the mask for the permissions that are mask relative.
- * Flip the bits, we want what's not set. Since it's possible that
- * the caller is opening files inside a signal handler, protect them
- * as best we can.
- */
- sigfillset(&sigset);
- (void)sigprocmask(SIG_BLOCK, &sigset, &sigoset);
- (void)umask(mask = umask(0));
- mask = ~mask;
- (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
-
- setlen = SET_LEN + 2;
-
- if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
- return (NULL);
- saveset = set;
- endset = set + (setlen - 2);
-
- /*
- * If an absolute number, get it and return; disallow non-octal digits
- * or illegal bits.
- */
- if (isdigit((unsigned char)*p)) {
- perm = (mode_t)strtol(p, &ep, 8);
- if (*ep || perm & ~(STANDARD_BITS|S_ISTXT)) {
- free(saveset);
- return (NULL);
- }
- ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
- set->cmd = 0;
- return (saveset);
- }
-
- /*
- * Build list of structures to set/clear/copy bits as described by
- * each clause of the symbolic mode.
- */
- for (;;) {
- /* First, find out which bits might be modified. */
- for (who = 0;; ++p) {
- switch (*p) {
- case 'a':
- who |= STANDARD_BITS;
- break;
- case 'u':
- who |= S_ISUID|S_IRWXU;
- break;
- case 'g':
- who |= S_ISGID|S_IRWXG;
- break;
- case 'o':
- who |= S_IRWXO;
- break;
- default:
- goto getop;
- }
- }
-
-getop: if ((op = *p++) != '+' && op != '-' && op != '=') {
- free(saveset);
- return (NULL);
- }
- if (op == '=')
- equalopdone = 0;
-
- who &= ~S_ISTXT;
- for (perm = 0, permXbits = 0;; ++p) {
- switch (*p) {
- case 'r':
- perm |= S_IRUSR|S_IRGRP|S_IROTH;
- break;
- case 's':
- /*
- * If specific bits where requested and
- * only "other" bits ignore set-id.
- */
- if (who == 0 || (who & ~S_IRWXO))
- perm |= S_ISUID|S_ISGID;
- break;
- case 't':
- /*
- * If specific bits where requested and
- * only "other" bits ignore set-id.
- */
- if (who == 0 || (who & ~S_IRWXO)) {
- who |= S_ISTXT;
- perm |= S_ISTXT;
- }
- break;
- case 'w':
- perm |= S_IWUSR|S_IWGRP|S_IWOTH;
- break;
- case 'X':
- permXbits = S_IXUSR|S_IXGRP|S_IXOTH;
- break;
- case 'x':
- perm |= S_IXUSR|S_IXGRP|S_IXOTH;
- break;
- case 'u':
- case 'g':
- case 'o':
- /*
- * When ever we hit 'u', 'g', or 'o', we have
- * to flush out any partial mode that we have,
- * and then do the copying of the mode bits.
- */
- if (perm) {
- ADDCMD(op, who, perm, mask);
- perm = 0;
- }
- if (op == '=')
- equalopdone = 1;
- if (op == '+' && permXbits) {
- ADDCMD('X', who, permXbits, mask);
- permXbits = 0;
- }
- ADDCMD(*p, who, op, mask);
- break;
-
- default:
- /*
- * Add any permissions that we haven't already
- * done.
- */
- if (perm || (op == '=' && !equalopdone)) {
- if (op == '=')
- equalopdone = 1;
- ADDCMD(op, who, perm, mask);
- perm = 0;
- }
- if (permXbits) {
- ADDCMD('X', who, permXbits, mask);
- permXbits = 0;
- }
- goto apply;
- }
- }
-
-apply: if (!*p)
- break;
- if (*p != ',')
- goto getop;
- ++p;
- }
- set->cmd = 0;
-#ifdef SETMODE_DEBUG
- (void)printf("Before compress_mode()\n");
- dumpmode(saveset);
-#endif
- compress_mode(saveset);
-#ifdef SETMODE_DEBUG
- (void)printf("After compress_mode()\n");
- dumpmode(saveset);
-#endif
- return (saveset);
-}
-
-static BITCMD *
-addcmd(set, op, who, oparg, mask)
- BITCMD *set;
- int oparg, who;
- int op;
- u_int mask;
-{
-
- _DIAGASSERT(set != NULL);
-
- switch (op) {
- case '=':
- set->cmd = '-';
- set->bits = who ? who : STANDARD_BITS;
- set++;
-
- op = '+';
- /* FALLTHROUGH */
- case '+':
- case '-':
- case 'X':
- set->cmd = op;
- set->bits = (who ? who : mask) & oparg;
- break;
-
- case 'u':
- case 'g':
- case 'o':
- set->cmd = op;
- if (who) {
- set->cmd2 = ((who & S_IRUSR) ? CMD2_UBITS : 0) |
- ((who & S_IRGRP) ? CMD2_GBITS : 0) |
- ((who & S_IROTH) ? CMD2_OBITS : 0);
- set->bits = (mode_t)~0;
- } else {
- set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS;
- set->bits = mask;
- }
-
- if (oparg == '+')
- set->cmd2 |= CMD2_SET;
- else if (oparg == '-')
- set->cmd2 |= CMD2_CLR;
- else if (oparg == '=')
- set->cmd2 |= CMD2_SET|CMD2_CLR;
- break;
- }
- return (set + 1);
-}
-
-#ifdef SETMODE_DEBUG
-static void
-dumpmode(set)
- BITCMD *set;
-{
-
- _DIAGASSERT(set != NULL);
-
- for (; set->cmd; ++set)
- (void)printf("cmd: '%c' bits %04o%s%s%s%s%s%s\n",
- set->cmd, set->bits, set->cmd2 ? " cmd2:" : "",
- set->cmd2 & CMD2_CLR ? " CLR" : "",
- set->cmd2 & CMD2_SET ? " SET" : "",
- set->cmd2 & CMD2_UBITS ? " UBITS" : "",
- set->cmd2 & CMD2_GBITS ? " GBITS" : "",
- set->cmd2 & CMD2_OBITS ? " OBITS" : "");
-}
-#endif
-
-/*
- * Given an array of bitcmd structures, compress by compacting consecutive
- * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
- * 'g' and 'o' commands continue to be separate. They could probably be
- * compacted, but it's not worth the effort.
- */
-static void
-compress_mode(set)
- BITCMD *set;
-{
- BITCMD *nset;
- int setbits, clrbits, Xbits, op;
-
- _DIAGASSERT(set != NULL);
-
- for (nset = set;;) {
- /* Copy over any 'u', 'g' and 'o' commands. */
- while ((op = nset->cmd) != '+' && op != '-' && op != 'X') {
- *set++ = *nset++;
- if (!op)
- return;
- }
-
- for (setbits = clrbits = Xbits = 0;; nset++) {
- if ((op = nset->cmd) == '-') {
- clrbits |= nset->bits;
- setbits &= ~nset->bits;
- Xbits &= ~nset->bits;
- } else if (op == '+') {
- setbits |= nset->bits;
- clrbits &= ~nset->bits;
- Xbits &= ~nset->bits;
- } else if (op == 'X')
- Xbits |= nset->bits & ~setbits;
- else
- break;
- }
- if (clrbits) {
- set->cmd = '-';
- set->cmd2 = 0;
- set->bits = clrbits;
- set++;
- }
- if (setbits) {
- set->cmd = '+';
- set->cmd2 = 0;
- set->bits = setbits;
- set++;
- }
- if (Xbits) {
- set->cmd = 'X';
- set->cmd2 = 0;
- set->bits = Xbits;
- set++;
- }
- }
-}
-#endif /* !HAVE_SETMODE */
diff --git a/pkgtools/libnbcompat/files/sha1.c b/pkgtools/libnbcompat/files/sha1.c
index 5f7dd82a2d4..b81f292e13c 100644
--- a/pkgtools/libnbcompat/files/sha1.c
+++ b/pkgtools/libnbcompat/files/sha1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1.c,v 1.3 2003/09/03 13:11:15 jlam Exp $ */
+/* $NetBSD: sha1.c,v 1.4 2003/09/05 18:36:04 jlam Exp $ */
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
/*
@@ -33,7 +33,7 @@
#include <string.h>
#endif
-#include <sha1.h>
+#include "nbcompat/sha1.h"
#ifndef _DIAGASSERT
#define _DIAGASSERT(cond) assert(cond)
diff --git a/pkgtools/libnbcompat/files/sha1hl.c b/pkgtools/libnbcompat/files/sha1hl.c
index 856b2a1ad55..bed1d77eb9a 100644
--- a/pkgtools/libnbcompat/files/sha1hl.c
+++ b/pkgtools/libnbcompat/files/sha1hl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $ */
+/* $NetBSD: sha1hl.c,v 1.4 2003/09/05 18:36:05 jlam Exp $ */
/* sha1hl.c
* ----------------------------------------------------------------------------
@@ -27,7 +27,7 @@
#include <assert.h>
#include <errno.h>
-#include <sha1.h>
+#include "nbcompat/sha1.h"
#include <stdio.h>
#include <stdlib.h>
#if HAVE_UNISTD_H
@@ -35,7 +35,7 @@
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sha1hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
+__RCSID("$NetBSD: sha1hl.c,v 1.4 2003/09/05 18:36:05 jlam Exp $");
#endif /* LIBC_SCCS and not lint */
#ifndef _DIAGASSERT
diff --git a/pkgtools/libnbcompat/files/sha2.c b/pkgtools/libnbcompat/files/sha2.c
index 4348b0f16f7..ec9ea5430a1 100644
--- a/pkgtools/libnbcompat/files/sha2.c
+++ b/pkgtools/libnbcompat/files/sha2.c
@@ -44,7 +44,7 @@
#include <stdio.h>
#include <string.h> /* memcpy()/memset() or bcopy()/bzero() */
#include <assert.h> /* assert() */
-#include "sha2.h"
+#include "nbcompat/sha2.h"
/*
* ASSERT NOTE:
diff --git a/pkgtools/libnbcompat/files/sha2hl.c b/pkgtools/libnbcompat/files/sha2hl.c
index 0adcf8756bb..70ea18182ac 100644
--- a/pkgtools/libnbcompat/files/sha2hl.c
+++ b/pkgtools/libnbcompat/files/sha2hl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $ */
+/* $NetBSD: sha2hl.c,v 1.4 2003/09/05 18:36:05 jlam Exp $ */
/*
* sha2hl.c
@@ -47,7 +47,7 @@
#include "nbcompat/nbtypes.h"
#ifndef lint
-__RCSID("$NetBSD: sha2hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
+__RCSID("$NetBSD: sha2hl.c,v 1.4 2003/09/05 18:36:05 jlam Exp $");
#endif /* not lint */
@@ -60,7 +60,7 @@ __RCSID("$NetBSD: sha2hl.c,v 1.3 2003/09/03 13:11:15 jlam Exp $");
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#include <sha2.h>
+#include "nbcompat/sha2.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/pkgtools/libnbcompat/files/spec.c b/pkgtools/libnbcompat/files/spec.c
deleted file mode 100644
index 39a259c5454..00000000000
--- a/pkgtools/libnbcompat/files/spec.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/* $NetBSD: spec.c,v 1.4 2003/09/03 13:11:15 jlam Exp $ */
-
-/*-
- * Copyright (c) 1989, 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.
- */
-
-/*-
- * Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Luke Mewburn of Wasabi Systems.
- *
- * 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"
-
-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
-
-#if defined(__RCSID) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
-#else
-__RCSID("$NetBSD: spec.c,v 1.4 2003/09/03 13:11:15 jlam Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <grp.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#if HAVE_VIS_H
-#include <vis.h>
-#endif
-
-#include "extern.h"
-#include "pack_dev.h"
-
-size_t mtree_lineno; /* Current spec line number */
-int Wflag; /* Don't "whack" permissions */
-
-static dev_t parsedev(char *);
-static void replacenode(NODE *, NODE *);
-static void set(char *, NODE *);
-static void unset(char *, NODE *);
-
-NODE *
-spec(FILE *fp)
-{
- NODE *centry, *last, *pathparent, *cur;
- char *p, *e, *next;
- NODE ginfo, *root;
- char *buf, *tname;
- size_t tnamelen, plen;
-
- root = NULL;
- centry = last = NULL;
- tname = NULL;
- tnamelen = 0;
- memset(&ginfo, 0, sizeof(ginfo));
- for (mtree_lineno = 0;
- (buf = fparseln(fp, NULL, &mtree_lineno, NULL,
- FPARSELN_UNESCCOMM | FPARSELN_UNESCCONT | FPARSELN_UNESCESC));
- free(buf)) {
- /* Skip leading whitespace. */
- for (p = buf; *p && isspace((unsigned char)*p); ++p)
- continue;
-
- /* If nothing but whitespace, continue. */
- if (!*p)
- continue;
-
-#ifdef DEBUG
- fprintf(stderr, "line %lu: {%s}\n",
- (u_long)mtree_lineno, p);
-#endif
- /* Grab file name, "$", "set", or "unset". */
- next = buf;
- while ((p = strsep(&next, " \t")) != NULL && *p == '\0')
- continue;
- if (p == NULL)
- mtree_err("missing field");
-
- if (p[0] == '/') {
- if (strcmp(p + 1, "set") == 0)
- set(next, &ginfo);
- else if (strcmp(p + 1, "unset") == 0)
- unset(next, &ginfo);
- else
- mtree_err("invalid specification `%s'", p);
- continue;
- }
-
- if (strcmp(p, "..") == 0) {
- /* Don't go up, if haven't gone down. */
- if (root == NULL)
- goto noparent;
- if (last->type != F_DIR || last->flags & F_DONE) {
- if (last == root)
- goto noparent;
- last = last->parent;
- }
- last->flags |= F_DONE;
- continue;
-
-noparent: mtree_err("no parent node");
- }
-
- plen = strlen(p) + 1;
- if (plen > tnamelen) {
- tnamelen = plen;
- if ((tname = realloc(tname, tnamelen)) == NULL)
- mtree_err("realloc: %s", strerror(errno));
- }
- if (strunvis(tname, p) == -1)
- mtree_err("strunvis failed on `%s'", p);
- p = tname;
-
- pathparent = NULL;
- if (strchr(p, '/') != NULL) {
- cur = root;
- for (; (e = strchr(p, '/')) != NULL; p = e+1) {
- if (p == e)
- continue; /* handle // */
- *e = '\0';
- if (strcmp(p, ".") != 0) {
- while (cur &&
- strcmp(cur->name, p) != 0) {
- cur = cur->next;
- }
- }
- if (cur == NULL || cur->type != F_DIR) {
- mtree_err("%s: %s", tname,
- strerror(ENOENT));
- }
- *e = '/';
- pathparent = cur;
- cur = cur->child;
- }
- if (*p == '\0')
- mtree_err("%s: empty leaf element", tname);
- }
-
- if ((centry = calloc(1, sizeof(NODE) + strlen(p))) == NULL)
- mtree_err("%s", strerror(errno));
- *centry = ginfo;
- centry->lineno = mtree_lineno;
- strcpy(centry->name, p);
-#define MAGIC "?*["
- if (strpbrk(p, MAGIC))
- centry->flags |= F_MAGIC;
- set(next, centry);
-
- if (root == NULL) {
- /*
- * empty tree
- */
- if (strcmp(centry->name, ".") != 0 ||
- centry->type != F_DIR)
- mtree_err(
- "root node must be the directory `.'");
- last = root = centry;
- root->parent = root;
- } else if (pathparent != NULL) {
- /*
- * full path entry
- */
- centry->parent = pathparent;
- cur = pathparent->child;
- if (cur == NULL) {
- pathparent->child = centry;
- last = centry;
- } else {
- for (; cur != NULL; cur = cur->next) {
- if (strcmp(cur->name, centry->name)
- == 0) {
- /* existing entry; replace */
- replacenode(cur, centry);
- break;
- }
- if (cur->next == NULL) {
- /* last entry; add new */
- cur->next = centry;
- centry->prev = cur;
- break;
- }
- }
- last = cur;
- while (last->next != NULL)
- last = last->next;
- }
- } else if (strcmp(centry->name, ".") == 0) {
- /*
- * duplicate "." entry; always replace
- */
- replacenode(root, centry);
- } else if (last->type == F_DIR && !(last->flags & F_DONE)) {
- /*
- * new relative child
- * (no duplicate check)
- */
- centry->parent = last;
- last = last->child = centry;
- } else {
- /*
- * relative entry, up one directory
- * (no duplicate check)
- */
- centry->parent = last->parent;
- centry->prev = last;
- last = last->next = centry;
- }
- }
- return (root);
-}
-
-/*
- * dump_nodes --
- * dump the NODEs from `cur', based in the directory `dir'.
- * if pathlast is none zero, print the path last, otherwise print
- * it first.
- */
-void
-dump_nodes(const char *dir, NODE *root, int pathlast)
-{
- NODE *cur;
- char path[MAXPATHLEN];
- const char *name;
-
- for (cur = root; cur != NULL; cur = cur->next) {
- if (cur->type != F_DIR && !matchtags(cur))
- continue;
-
- if (snprintf(path, sizeof(path), "%s%s%s",
- dir, *dir ? "/" : "", cur->name)
- >= sizeof(path))
- mtree_err("Pathname too long.");
-
- if (!pathlast)
- printf("%s ", vispath(path));
-
-#define MATCHFLAG(f) ((keys & (f)) && (cur->flags & (f)))
- if (MATCHFLAG(F_TYPE))
- printf("type=%s ", nodetype(cur->type));
- if (MATCHFLAG(F_UID | F_UNAME)) {
- if (keys & F_UNAME &&
- (name = user_from_uid(cur->st_uid, 1)) != NULL)
- printf("uname=%s ", name);
- else
- printf("uid=%u ", cur->st_uid);
- }
- if (MATCHFLAG(F_GID | F_GNAME)) {
- if (keys & F_GNAME &&
- (name = group_from_gid(cur->st_gid, 1)) != NULL)
- printf("gname=%s ", name);
- else
- printf("gid=%u ", cur->st_gid);
- }
- if (MATCHFLAG(F_MODE))
- printf("mode=%#o ", cur->st_mode);
- if (MATCHFLAG(F_DEV) &&
- (cur->type == F_BLOCK || cur->type == F_CHAR))
- printf("device=%#x ", cur->st_rdev);
- if (MATCHFLAG(F_NLINK))
- printf("nlink=%d ", cur->st_nlink);
- if (MATCHFLAG(F_SLINK))
- printf("link=%s ", cur->slink);
- if (MATCHFLAG(F_SIZE))
- printf("size=%lld ", (long long)cur->st_size);
- if (MATCHFLAG(F_TIME))
- printf("time=%ld.%ld ", (long)cur->st_mtimespec.tv_sec,
- cur->st_mtimespec.tv_nsec);
- if (MATCHFLAG(F_CKSUM))
- printf("cksum=%lu ", cur->cksum);
- if (MATCHFLAG(F_MD5))
- printf("md5=%s ", cur->md5digest);
- if (MATCHFLAG(F_RMD160))
- printf("rmd160=%s ", cur->rmd160digest);
- if (MATCHFLAG(F_SHA1))
- printf("sha1=%s ", cur->sha1digest);
- if (MATCHFLAG(F_FLAGS))
- printf("flags=%s ",
- flags_to_string(cur->st_flags, "none"));
- if (MATCHFLAG(F_IGN))
- printf("ignore ");
- if (MATCHFLAG(F_OPT))
- printf("optional ");
- if (MATCHFLAG(F_TAGS))
- printf("tags=%s ", cur->tags);
- puts(pathlast ? vispath(path) : "");
-
- if (cur->child)
- dump_nodes(path, cur->child, pathlast);
- }
-}
-
-/*
- * vispath --
- * strsvis(3) encodes path, which must not be longer than MAXPATHLEN
- * characters long, and returns a pointer to a static buffer containing
- * the result.
- */
-char *
-vispath(const char *path)
-{
- const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' };
- static char pathbuf[4*MAXPATHLEN + 1];
-
- strsvis(pathbuf, path, VIS_CSTYLE, extra);
- return(pathbuf);
-}
-
-
-static dev_t
-parsedev(char *arg)
-{
-#define MAX_PACK_ARGS 3
- u_long numbers[MAX_PACK_ARGS];
- char *p, *ep, *dev;
- int argc;
- pack_t *pack;
- dev_t result;
-
- if ((dev = strchr(arg, ',')) != NULL) {
- *dev++='\0';
- if ((pack = pack_find(arg)) == NULL)
- mtree_err("unknown format `%s'", arg);
- argc = 0;
- while ((p = strsep(&dev, ",")) != NULL) {
- if (*p == '\0')
- mtree_err("missing number");
- numbers[argc++] = strtoul(p, &ep, 0);
- if (*ep != '\0')
- mtree_err("invalid number `%s'",
- p);
- if (argc > MAX_PACK_ARGS)
- mtree_err("too many arguments");
- }
- if (argc < 2)
- mtree_err("not enough arguments");
- result = (*pack)(argc, numbers);
- } else {
- result = (dev_t)strtoul(arg, &ep, 0);
- if (*ep != '\0')
- mtree_err("invalid device `%s'", arg);
- }
- return (result);
-}
-
-static void
-replacenode(NODE *cur, NODE *new)
-{
-
- if (cur->type != new->type)
- mtree_err("existing entry type `%s' does not match type `%s'",
- nodetype(cur->type), nodetype(new->type));
-#define REPLACE(x) cur->x = new->x
-#define REPLACESTR(x) if (cur->x) free(cur->x); cur->x = new->x
-
- REPLACE(st_size);
- REPLACE(st_mtimespec);
- REPLACESTR(slink);
- REPLACE(st_uid);
- REPLACE(st_gid);
- REPLACE(st_mode);
- REPLACE(st_rdev);
- REPLACE(st_flags);
- REPLACE(st_nlink);
- REPLACE(cksum);
- REPLACESTR(md5digest);
- REPLACESTR(rmd160digest);
- REPLACESTR(sha1digest);
- REPLACESTR(tags);
- REPLACE(lineno);
- REPLACE(flags);
- free(new);
-}
-
-static void
-set(char *t, NODE *ip)
-{
- int type, value, len;
- gid_t gid;
- uid_t uid;
- char *kw, *val, *md, *ep;
- void *m;
-
- val = NULL;
- while ((kw = strsep(&t, "= \t")) != NULL) {
- if (*kw == '\0')
- continue;
- if (strcmp(kw, "all") == 0)
- mtree_err("invalid keyword `all'");
- ip->flags |= type = parsekey(kw, &value);
- if (value) {
- while ((val = strsep(&t, " \t")) != NULL &&
- *val == '\0')
- continue;
- if (val == NULL)
- mtree_err("missing value");
- }
- switch(type) {
- case F_CKSUM:
- ip->cksum = strtoul(val, &ep, 10);
- if (*ep)
- mtree_err("invalid checksum `%s'", val);
- break;
- case F_DEV:
- ip->st_rdev = parsedev(val);
- break;
- case F_FLAGS:
- if (strcmp("none", val) == 0)
- ip->st_flags = 0;
- else if (string_to_flags(&val, &ip->st_flags, NULL)
- != 0)
- mtree_err("invalid flag `%s'", val);
- break;
- case F_GID:
- ip->st_gid = (gid_t)strtoul(val, &ep, 10);
- if (*ep)
- mtree_err("invalid gid `%s'", val);
- break;
- case F_GNAME:
- if (Wflag) /* don't parse if whacking */
- break;
- if (gid_from_group(val, &gid) == -1)
- mtree_err("unknown group `%s'", val);
- ip->st_gid = gid;
- break;
- case F_IGN:
- /* just set flag bit */
- break;
- case F_MD5:
- if (val[0]=='0' && val[1]=='x')
- md=&val[2];
- else
- md=val;
- if ((ip->md5digest = strdup(md)) == NULL)
- mtree_err("memory allocation error");
- break;
- case F_MODE:
- if ((m = setmode(val)) == NULL)
- mtree_err("invalid file mode `%s'", val);
- ip->st_mode = getmode(m, 0);
- free(m);
- break;
- case F_NLINK:
- ip->st_nlink = (nlink_t)strtoul(val, &ep, 10);
- if (*ep)
- mtree_err("invalid link count `%s'", val);
- break;
- case F_OPT:
- /* just set flag bit */
- break;
- case F_RMD160:
- if (val[0]=='0' && val[1]=='x')
- md=&val[2];
- else
- md=val;
- if ((ip->rmd160digest = strdup(md)) == NULL)
- mtree_err("memory allocation error");
- break;
- case F_SHA1:
- if (val[0]=='0' && val[1]=='x')
- md=&val[2];
- else
- md=val;
- if ((ip->sha1digest = strdup(md)) == NULL)
- mtree_err("memory allocation error");
- break;
- case F_SIZE:
- ip->st_size = (off_t)strtoll(val, &ep, 10);
- if (*ep)
- mtree_err("invalid size `%s'", val);
- break;
- case F_SLINK:
- if ((ip->slink = strdup(val)) == NULL)
- mtree_err("memory allocation error");
- break;
- case F_TAGS:
- len = strlen(val) + 3; /* "," + str + ",\0" */
- if ((ip->tags = malloc(len)) == NULL)
- mtree_err("memory allocation error");
- snprintf(ip->tags, len, ",%s,", val);
- break;
- case F_TIME:
- ip->st_mtimespec.tv_sec =
- (time_t)strtoul(val, &ep, 10);
- if (*ep != '.')
- mtree_err("invalid time `%s'", val);
- val = ep + 1;
- ip->st_mtimespec.tv_nsec = strtoul(val, &ep, 10);
- if (*ep)
- mtree_err("invalid time `%s'", val);
- break;
- case F_TYPE:
- ip->type = parsetype(val);
- break;
- case F_UID:
- ip->st_uid = (uid_t)strtoul(val, &ep, 10);
- if (*ep)
- mtree_err("invalid uid `%s'", val);
- break;
- case F_UNAME:
- if (Wflag) /* don't parse if whacking */
- break;
- if (uid_from_user(val, &uid) == -1)
- mtree_err("unknown user `%s'", val);
- ip->st_uid = uid;
- break;
- default:
- mtree_err(
- "set(): unsupported key type 0x%x (INTERNAL ERROR)",
- type);
- /* NOTREACHED */
- }
- }
-}
-
-static void
-unset(char *t, NODE *ip)
-{
- char *p;
-
- while ((p = strsep(&t, " \t")) != NULL) {
- if (*p == '\0')
- continue;
- ip->flags &= ~parsekey(p, NULL);
- }
-}
diff --git a/pkgtools/libnbcompat/files/stat_flags.c b/pkgtools/libnbcompat/files/stat_flags.c
deleted file mode 100644
index 991fec529d7..00000000000
--- a/pkgtools/libnbcompat/files/stat_flags.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* $NetBSD: stat_flags.c,v 1.4 2003/09/03 13:11:15 jlam Exp $ */
-
-/*-
- * Copyright (c) 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.
- */
-
-#include "nbcompat.h"
-
-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
-
-#if defined(__RCSID) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94";
-#else
-__RCSID("$NetBSD: stat_flags.c,v 1.4 2003/09/03 13:11:15 jlam Exp $");
-#endif
-#endif /* not lint */
-
-#ifdef __NetBSD__
-#define HAVE_STRUCT_STAT_ST_FLAGS 1
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/stat.h>
-#endif
-#if HAVE_FTS_H
-#include <fts.h>
-#endif
-#include <stddef.h>
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include "stat_flags.h"
-
-#define SAPPEND(s) { \
- if (prefix != NULL) \
- (void)strcat(string, prefix); \
- (void)strcat(string, s); \
- prefix = ","; \
-}
-
-/*
- * flags_to_string --
- * Convert stat flags to a comma-separated string. If no flags
- * are set, return the default string.
- */
-char *
-flags_to_string(u_long flags, const char *def)
-{
- static char string[128];
- const char *prefix;
-
- string[0] = '\0';
- prefix = NULL;
-#if HAVE_STRUCT_STAT_ST_FLAGS
- if (flags & UF_APPEND)
- SAPPEND("uappnd");
- if (flags & UF_IMMUTABLE)
- SAPPEND("uchg");
- if (flags & UF_NODUMP)
- SAPPEND("nodump");
- if (flags & UF_OPAQUE)
- SAPPEND("opaque");
- if (flags & SF_APPEND)
- SAPPEND("sappnd");
- if (flags & SF_ARCHIVED)
- SAPPEND("arch");
- if (flags & SF_IMMUTABLE)
- SAPPEND("schg");
-#endif
- if (prefix == NULL)
-#if defined(netbsd) || defined(openbsd) || defined(freebsd)
- strlcpy(string, def, sizeof(string));
-#else
- strncpy(string, def, sizeof(string));
-#endif
- return (string);
-}
-
-#define TEST(a, b, f) { \
- if (!strcmp(a, b)) { \
- if (clear) { \
- if (clrp) \
- *clrp |= (f); \
- if (setp) \
- *setp &= ~(f); \
- } else { \
- if (setp) \
- *setp |= (f); \
- if (clrp) \
- *clrp &= ~(f); \
- } \
- break; \
- } \
-}
-
-/*
- * string_to_flags --
- * Take string of arguments and return stat flags. Return 0 on
- * success, 1 on failure. On failure, stringp is set to point
- * to the offending token.
- */
-int
-string_to_flags(char **stringp, u_long *setp, u_long *clrp)
-{
-#if HAVE_STRUCT_STAT_ST_FLAGS
- int clear;
- char *string, *p;
-#endif
-
- if (setp)
- *setp = 0;
- if (clrp)
- *clrp = 0;
-
-#if HAVE_STRUCT_STAT_ST_FLAGS
- string = *stringp;
- while ((p = strsep(&string, "\t ,")) != NULL) {
- clear = 0;
- *stringp = p;
- if (*p == '\0')
- continue;
- if (p[0] == 'n' && p[1] == 'o') {
- clear = 1;
- p += 2;
- }
- switch (p[0]) {
- case 'a':
- TEST(p, "arch", SF_ARCHIVED);
- TEST(p, "archived", SF_ARCHIVED);
- return (1);
- case 'd':
- clear = !clear;
- TEST(p, "dump", UF_NODUMP);
- return (1);
- case 'n':
- /*
- * Support `nonodump'. Note that
- * the state of clear is not changed.
- */
- TEST(p, "nodump", UF_NODUMP);
- return (1);
- case 'o':
- TEST(p, "opaque", UF_OPAQUE);
- return (1);
- case 's':
- TEST(p, "sappnd", SF_APPEND);
- TEST(p, "sappend", SF_APPEND);
- TEST(p, "schg", SF_IMMUTABLE);
- TEST(p, "schange", SF_IMMUTABLE);
- TEST(p, "simmutable", SF_IMMUTABLE);
- return (1);
- case 'u':
- TEST(p, "uappnd", UF_APPEND);
- TEST(p, "uappend", UF_APPEND);
- TEST(p, "uchg", UF_IMMUTABLE);
- TEST(p, "uchange", UF_IMMUTABLE);
- TEST(p, "uimmutable", UF_IMMUTABLE);
- return (1);
- default:
- return (1);
- }
- }
-#endif
-
- return (0);
-}
diff --git a/pkgtools/libnbcompat/files/stat_flags.h b/pkgtools/libnbcompat/files/stat_flags.h
deleted file mode 100644
index fc4c7d08582..00000000000
--- a/pkgtools/libnbcompat/files/stat_flags.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $NetBSD: stat_flags.h,v 1.1.1.1 2003/03/31 05:03:04 grant 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.
- *
- * @(#)extern.h 8.1 (Berkeley) 5/31/93
- */
-
-char *flags_to_string(u_long, const char *);
-int string_to_flags(char **, u_long *, u_long *);