Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Make almost all tools compile and run properly on non-NetBSD...
details: https://anonhg.NetBSD.org/src/rev/e00d90191c9d
branches: trunk
changeset: 521369:e00d90191c9d
user: tv <tv%NetBSD.org@localhost>
date: Tue Jan 29 10:20:28 2002 +0000
description:
Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
diffstat:
bin/pax/Makefile | 8 +-
bin/pax/ar_io.c | 5 +-
bin/pax/extern.h | 14 +-
bin/pax/file_subs.c | 48 +-
bin/pax/ftree.c | 15 +-
bin/pax/getoldopt.c | 8 +-
bin/pax/options.c | 8 +-
bin/pax/pax.c | 6 +-
bin/pax/tables.c | 12 +-
gnu/usr.sbin/dbsym/Makefile | 5 +-
gnu/usr.sbin/mdsetimage/Makefile | 5 +-
lib/libc/gen/pw_scan.c | 11 +-
lib/libc/gen/pwcache.c | 8 +-
lib/libc/stdlib/getopt_long.c | 11 +-
lib/libc/string/strmode.c | 8 +-
libexec/makewhatis/Makefile | 6 +-
libexec/makewhatis/makewhatis.c | 20 +-
tools/Makefile | 19 +-
tools/Makefile.host | 17 +-
tools/compat/Makefile | 41 +-
tools/compat/compat_defs.h | 231 +++++-
tools/compat/compat_fts.h | 3 +
tools/compat/compat_pwd.h | 65 +
tools/compat/compat_vis.h | 88 +--
tools/compat/config.h.in | 41 +-
tools/compat/configure | 1287 +++++++++++++++++++++++++++++++------
tools/compat/configure.ac | 48 +-
tools/compat/db.h | 4 +-
tools/compat/defs.mk.in | 13 +-
tools/compat/err.c | 110 ---
tools/compat/getopt.h | 3 +
tools/compat/nl_types.h | 5 +
tools/compat/setenv.c | 59 +
tools/compat/setgroupent.c | 14 +
tools/compat/setpassent.c | 14 +
tools/compat/snprintf.c | 660 +++++++++++++++++++
tools/config/Makefile | 4 +-
tools/groff/Makefile | 4 +-
usr.bin/gencat/gencat.c | 15 +-
usr.bin/lex/flexdef.h | 6 +-
usr.bin/lex/main.c | 4 +-
usr.bin/lex/parse.y | 14 +-
usr.bin/menuc/defs.h | 6 +-
usr.bin/mklocale/lex.l | 12 +-
usr.bin/mklocale/yacc.y | 15 +-
usr.bin/msgc/defs.h | 6 +-
usr.bin/rpcgen/rpc_cout.c | 9 +-
usr.bin/rpcgen/rpc_hout.c | 9 +-
usr.bin/rpcgen/rpc_main.c | 13 +-
usr.bin/rpcgen/rpc_scan.h | 8 +-
usr.bin/yacc/defs.h | 6 +-
usr.sbin/config/Makefile.boot | 4 +-
usr.sbin/config/config.h | 466 -------------
usr.sbin/config/defs.h | 473 +++++++++++++
usr.sbin/config/files.c | 4 +-
usr.sbin/config/gram.y | 4 +-
usr.sbin/config/hash.c | 4 +-
usr.sbin/config/main.c | 27 +-
usr.sbin/config/mkheaders.c | 4 +-
usr.sbin/config/mkioconf.c | 4 +-
usr.sbin/config/mkmakefile.c | 4 +-
usr.sbin/config/mkswap.c | 4 +-
usr.sbin/config/pack.c | 4 +-
usr.sbin/config/scan.l | 4 +-
usr.sbin/config/sem.c | 4 +-
usr.sbin/config/util.c | 4 +-
usr.sbin/mtree/excludes.c | 5 +-
usr.sbin/mtree/extern.h | 3 +-
usr.sbin/mtree/getid.c | 4 +-
usr.sbin/mtree/spec.c | 9 +-
usr.sbin/pwd_mkdb/Makefile | 7 +-
usr.sbin/pwd_mkdb/pwd_mkdb.c | 28 +-
72 files changed, 3007 insertions(+), 1114 deletions(-)
diffs (truncated from 6144 to 300 lines):
diff -r 2abd605a0a35 -r e00d90191c9d bin/pax/Makefile
--- a/bin/pax/Makefile Tue Jan 29 08:46:59 2002 +0000
+++ b/bin/pax/Makefile Tue Jan 29 10:20:28 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2002/01/25 22:11:11 martin Exp $
+# $NetBSD: Makefile,v 1.16 2002/01/29 10:20:28 tv Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
# To install on versions prior to BSD 4.4 the following may have to be
@@ -36,9 +36,6 @@
# LINKS+= ${BINDIR}/pax ${BINDIR}/tar
# LINKS+= ${BINDIR}/pax ${BINDIR}/cpio
-LDADD+= -lutil
-DPADD+= ${LIBUTIL}
-
CPPFLAGS+= -I${.CURDIR}/../../usr.sbin/mtree \
-I${.CURDIR}/../../sbin/mknod \
-I${.CURDIR}/../../bin/ls
@@ -49,5 +46,8 @@
NOHTML=doc2html-error
.ifndef HOSTPROG
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
+
.include <bsd.prog.mk>
.endif
diff -r 2abd605a0a35 -r e00d90191c9d bin/pax/ar_io.c
--- a/bin/pax/ar_io.c Tue Jan 29 08:46:59 2002 +0000
+++ b/bin/pax/ar_io.c Tue Jan 29 10:20:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_io.c,v 1.20 2001/10/25 05:33:32 lukem Exp $ */
+/* $NetBSD: ar_io.c,v 1.21 2002/01/29 10:20:28 tv Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_io.c,v 1.20 2001/10/25 05:33:32 lukem Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.21 2002/01/29 10:20:28 tv Exp $");
#endif
#endif /* not lint */
@@ -60,7 +60,6 @@
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
-#include <err.h>
#include "pax.h"
#include "extern.h"
diff -r 2abd605a0a35 -r e00d90191c9d bin/pax/extern.h
--- a/bin/pax/extern.h Tue Jan 29 08:46:59 2002 +0000
+++ b/bin/pax/extern.h Tue Jan 29 10:20:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.28 2001/10/28 13:06:43 lukem Exp $ */
+/* $NetBSD: extern.h,v 1.29 2002/01/29 10:20:28 tv Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -39,6 +39,18 @@
* @(#)extern.h 8.2 (Berkeley) 4/18/94
*/
+#if HAVE_CONFIG_H
+#include "config.h"
+#else
+#define HAVE_ERR_H 1
+#define HAVE_FTS_H 1
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#endif
+
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+
/*
* External references from each source file
*/
diff -r 2abd605a0a35 -r e00d90191c9d bin/pax/file_subs.c
--- a/bin/pax/file_subs.c Tue Jan 29 08:46:59 2002 +0000
+++ b/bin/pax/file_subs.c Tue Jan 29 10:20:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: file_subs.c,v 1.20 2001/10/25 05:33:33 lukem Exp $ */
+/* $NetBSD: file_subs.c,v 1.21 2002/01/29 10:20:28 tv Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: file_subs.c,v 1.20 2001/10/25 05:33:33 lukem Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.21 2002/01/29 10:20:28 tv Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <sys/param.h>
-#include <err.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
@@ -168,8 +167,10 @@
set_pmode(arcn->name, arcn->sb.st_mode);
if (patime || pmtime)
set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (pfflags && arcn->type != PAX_SLK)
set_chflags(arcn->name, arcn->sb.st_flags);
+#endif
}
/*
@@ -434,7 +435,11 @@
/*
* we were able to create the node. set uid/gid, modes and times
*/
+#if HAVE_LCHOWN
if (pids)
+#else
+ if (pids && arcn->type != PAX_SLK)
+#endif
res = set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid);
else
res = 0;
@@ -446,7 +451,11 @@
*/
if (!pmode || res)
arcn->sb.st_mode &= ~(SETBITS);
+#if HAVE_LCHMOD
if (pmode)
+#else
+ if (pmode && arcn->type != PAX_SLK)
+#endif
set_pmode(arcn->name, arcn->sb.st_mode);
if (arcn->type == PAX_DIR) {
@@ -486,10 +495,17 @@
add_dir(arcn->name, arcn->nlen, &(arcn->sb), 0);
}
+#if HAVE_LUTIMES
if (patime || pmtime)
+#else
+ if ((patime || pmtime) && arcn->type != PAX_SLK)
+#endif
set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (pfflags && arcn->type != PAX_SLK)
set_chflags(arcn->name, arcn->sb.st_flags);
+#endif
return(0);
}
@@ -657,10 +673,17 @@
* set. We get the current values of the times if we need them.
*/
if (lstat(fnm, &sb) == 0) {
+#ifdef BSD4_4
if (!patime)
TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
if (!pmtime)
TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec);
+#else
+ if (!patime)
+ tv[0].tv_sec = sb.st_atime;
+ if (!pmtime)
+ tv[1].tv_sec = sb.st_mtime;
+#endif
} else
syswarn(0,errno,"Unable to obtain file stats %s", fnm);
}
@@ -668,7 +691,11 @@
/*
* set the times
*/
- if (lutimes(fnm, tv) < 0)
+#if HAVE_LUTIMES
+ if (lutimes(fnm, tv))
+#else
+ if (utimes(fnm, tv))
+#endif
syswarn(1, errno, "Access/modification time set failed on: %s",
fnm);
return;
@@ -684,7 +711,12 @@
int
set_ids(char *fnm, uid_t uid, gid_t gid)
{
- if (lchown(fnm, uid, gid) < 0) {
+#if HAVE_LCHOWN
+ if (lchown(fnm, uid, gid))
+#else
+ if (chown(fnm, uid, gid))
+#endif
+ {
syswarn(1, errno, "Unable to set file uid/gid of %s", fnm);
return(-1);
}
@@ -700,7 +732,11 @@
set_pmode(char *fnm, mode_t mode)
{
mode &= ABITS;
- if (lchmod(fnm, mode) < 0)
+#if HAVE_LCHMOD
+ if (lchmod(fnm, mode))
+#else
+ if (chmod(fnm, mode))
+#endif
syswarn(1, errno, "Could not set permissions on %s", fnm);
return;
}
diff -r 2abd605a0a35 -r e00d90191c9d bin/pax/ftree.c
--- a/bin/pax/ftree.c Tue Jan 29 08:46:59 2002 +0000
+++ b/bin/pax/ftree.c Tue Jan 29 10:20:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftree.c,v 1.15 2001/10/26 16:03:24 lukem Exp $ */
+/* $NetBSD: ftree.c,v 1.16 2002/01/29 10:20:29 tv Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -78,7 +78,7 @@
#if 0
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ftree.c,v 1.15 2001/10/26 16:03:24 lukem Exp $");
+__RCSID("$NetBSD: ftree.c,v 1.16 2002/01/29 10:20:29 tv Exp $");
#endif
#endif /* not lint */
@@ -92,12 +92,15 @@
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
-#include <fts.h>
#include "pax.h"
#include "ftree.h"
#include "extern.h"
#include "mtree.h"
+#if HAVE_FTS_H
+#include <fts.h>
+#endif
+
/*
* routines to interface with the fts library function.
*
@@ -487,10 +490,16 @@
statbuf.st_gid = ftnode->st_gid;
if (ftnode->flags & (F_UID | F_UNAME))
statbuf.st_uid = ftnode->st_uid;
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (ftnode->flags & F_FLAGS)
statbuf.st_flags = ftnode->st_flags;
+#endif
if (ftnode->flags & F_TIME)
+#ifdef BSD4_4
statbuf.st_mtimespec = ftnode->st_mtimespec;
+#else
+ statbuf.st_mtime = ftnode->st_mtimespec.tv_sec;
+#endif
if (ftnode->flags & F_DEV)
statbuf.st_rdev = ftnode->st_rdev;
if (ftnode->flags & F_SLINK)
diff -r 2abd605a0a35 -r e00d90191c9d bin/pax/getoldopt.c
--- a/bin/pax/getoldopt.c Tue Jan 29 08:46:59 2002 +0000
+++ b/bin/pax/getoldopt.c Tue Jan 29 10:20:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getoldopt.c,v 1.12 2001/11/03 12:49:31 lukem Exp $ */
+/* $NetBSD: getoldopt.c,v 1.13 2002/01/29 10:20:29 tv Exp $ */
/*
* Plug-compatible replacement for getopt() for parsing tar-like
@@ -11,17 +11,19 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: getoldopt.c,v 1.12 2001/11/03 12:49:31 lukem Exp $");
+__RCSID("$NetBSD: getoldopt.c,v 1.13 2002/01/29 10:20:29 tv Exp $");
#endif /* not lint */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <getopt.h>
#include <sys/stat.h>
#include "pax.h"
#include "extern.h"
+/* After extern.h to pull in HAVE_CONFIG_H */
+#include <getopt.h>
+
int
Home |
Main Index |
Thread Index |
Old Index