Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mtree account for differences in digest names
details: https://anonhg.NetBSD.org/src/rev/c9bc5e5b8583
branches: trunk
changeset: 781871:c9bc5e5b8583
user: christos <christos%NetBSD.org@localhost>
date: Fri Oct 05 00:59:35 2012 +0000
description:
account for differences in digest names
diffstat:
usr.sbin/mtree/compare.c | 52 ++++++++++++++++++++++++------------------------
usr.sbin/mtree/misc.c | 6 +++-
usr.sbin/mtree/mtree.8 | 5 +++-
usr.sbin/mtree/mtree.h | 18 +++++++++++++++-
usr.sbin/mtree/spec.c | 21 ++++++++++++-------
5 files changed, 64 insertions(+), 38 deletions(-)
diffs (257 lines):
diff -r d6fd3843b206 -r c9bc5e5b8583 usr.sbin/mtree/compare.c
--- a/usr.sbin/mtree/compare.c Fri Oct 05 00:58:46 2012 +0000
+++ b/usr.sbin/mtree/compare.c Fri Oct 05 00:59:35 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compare.c,v 1.54 2012/10/05 00:42:00 christos Exp $ */
+/* $NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: compare.c,v 1.54 2012/10/05 00:42:00 christos Exp $");
+__RCSID("$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $");
#endif
#endif /* not lint */
@@ -396,14 +396,14 @@
if (s->flags & F_MD5) {
if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL) {
LABEL;
- printf("%smd5: %s: %s\n",
- tab, p->fts_accpath, strerror(errno));
+ printf("%s%s: %s: %s\n",
+ tab, MD5KEY, p->fts_accpath, strerror(errno));
tab = "\t";
} else {
if (strcmp(s->md5digest, digestbuf)) {
LABEL;
- printf("%smd5 (0x%s, 0x%s)\n",
- tab, s->md5digest, digestbuf);
+ printf("%s%s (0x%s, 0x%s)\n",
+ tab, MD5KEY, s->md5digest, digestbuf);
}
tab = "\t";
free(digestbuf);
@@ -414,14 +414,14 @@
if (s->flags & F_RMD160) {
if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL) {
LABEL;
- printf("%srmd160: %s: %s\n",
- tab, p->fts_accpath, strerror(errno));
+ printf("%s%s: %s: %s\n",
+ tab, RMD160KEY, p->fts_accpath, strerror(errno));
tab = "\t";
} else {
if (strcmp(s->rmd160digest, digestbuf)) {
LABEL;
- printf("%srmd160 (0x%s, 0x%s)\n",
- tab, s->rmd160digest, digestbuf);
+ printf("%s%s (0x%s, 0x%s)\n",
+ tab, RMD160KEY, s->rmd160digest, digestbuf);
}
tab = "\t";
free(digestbuf);
@@ -432,14 +432,14 @@
if (s->flags & F_SHA1) {
if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL) {
LABEL;
- printf("%ssha1: %s: %s\n",
- tab, p->fts_accpath, strerror(errno));
+ printf("%s%s: %s: %s\n",
+ tab, SHA1KEY, p->fts_accpath, strerror(errno));
tab = "\t";
} else {
if (strcmp(s->sha1digest, digestbuf)) {
LABEL;
- printf("%ssha1 (0x%s, 0x%s)\n",
- tab, s->sha1digest, digestbuf);
+ printf("%s%s (0x%s, 0x%s)\n",
+ tab, SHA1KEY, s->sha1digest, digestbuf);
}
tab = "\t";
free(digestbuf);
@@ -450,14 +450,14 @@
if (s->flags & F_SHA256) {
if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL) {
LABEL;
- printf("%ssha256: %s: %s\n",
- tab, p->fts_accpath, strerror(errno));
+ printf("%s%s: %s: %s\n",
+ tab, SHA256KEY, p->fts_accpath, strerror(errno));
tab = "\t";
} else {
if (strcmp(s->sha256digest, digestbuf)) {
LABEL;
- printf("%ssha256 (0x%s, 0x%s)\n",
- tab, s->sha256digest, digestbuf);
+ printf("%s%s (0x%s, 0x%s)\n",
+ tab, SHA256KEY, s->sha256digest, digestbuf);
}
tab = "\t";
free(digestbuf);
@@ -467,14 +467,14 @@
if (s->flags & F_SHA384) {
if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) {
LABEL;
- printf("%ssha384: %s: %s\n",
- tab, p->fts_accpath, strerror(errno));
+ printf("%s%s: %s: %s\n",
+ tab, SHA384KEY, p->fts_accpath, strerror(errno));
tab = "\t";
} else {
if (strcmp(s->sha384digest, digestbuf)) {
LABEL;
- printf("%ssha384 (0x%s, 0x%s)\n",
- tab, s->sha384digest, digestbuf);
+ printf("%s%s (0x%s, 0x%s)\n",
+ tab, SHA384KEY, s->sha384digest, digestbuf);
}
tab = "\t";
free(digestbuf);
@@ -484,14 +484,14 @@
if (s->flags & F_SHA512) {
if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) {
LABEL;
- printf("%ssha512: %s: %s\n",
- tab, p->fts_accpath, strerror(errno));
+ printf("%s%s: %s: %s\n",
+ tab, SHA512KEY, p->fts_accpath, strerror(errno));
tab = "\t";
} else {
if (strcmp(s->sha512digest, digestbuf)) {
LABEL;
- printf("%ssha512 (0x%s, 0x%s)\n",
- tab, s->sha512digest, digestbuf);
+ printf("%s%s (0x%s, 0x%s)\n",
+ tab, SHA512KEY, s->sha512digest, digestbuf);
}
tab = "\t";
free(digestbuf);
diff -r d6fd3843b206 -r c9bc5e5b8583 usr.sbin/mtree/misc.c
--- a/usr.sbin/mtree/misc.c Fri Oct 05 00:58:46 2012 +0000
+++ b/usr.sbin/mtree/misc.c Fri Oct 05 00:59:35 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.30 2009/01/18 12:09:38 lukem Exp $ */
+/* $NetBSD: misc.c,v 1.31 2012/10/05 00:59:35 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: misc.c,v 1.30 2009/01/18 12:09:38 lukem Exp $");
+__RCSID("$NetBSD: misc.c,v 1.31 2012/10/05 00:59:35 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -72,6 +72,8 @@
{"mode", F_MODE, NEEDVALUE},
{"nlink", F_NLINK, NEEDVALUE},
{"optional", F_OPT, 0},
+ {"ripemd160digest", F_RMD160, NEEDVALUE},
+ {"rmd160digest",F_RMD160, NEEDVALUE},
{"rmd160", F_RMD160, NEEDVALUE},
{"rmd160digest",F_RMD160, NEEDVALUE},
{"sha1", F_SHA1, NEEDVALUE},
diff -r d6fd3843b206 -r c9bc5e5b8583 usr.sbin/mtree/mtree.8
--- a/usr.sbin/mtree/mtree.8 Fri Oct 05 00:58:46 2012 +0000
+++ b/usr.sbin/mtree/mtree.8 Fri Oct 05 00:59:35 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mtree.8,v 1.54 2012/10/03 19:27:48 wiz Exp $
+.\" $NetBSD: mtree.8,v 1.55 2012/10/05 00:59:35 christos Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -414,6 +414,9 @@
.It Sy optional
The file is optional; don't complain about the file if it's
not in the file hierarchy.
+.It Sy ripemd160digest
+Synonym for
+.Sy rmd160 .
.It Sy rmd160
The
.Tn RMD-160
diff -r d6fd3843b206 -r c9bc5e5b8583 usr.sbin/mtree/mtree.h
--- a/usr.sbin/mtree/mtree.h Fri Oct 05 00:58:46 2012 +0000
+++ b/usr.sbin/mtree/mtree.h Fri Oct 05 00:59:35 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mtree.h,v 1.27 2009/04/04 21:49:49 apb Exp $ */
+/* $NetBSD: mtree.h,v 1.28 2012/10/05 00:59:35 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -123,6 +123,22 @@
void free_nodes(NODE *);
char *vispath(const char *);
+#ifdef __FreeBSD__
+#define KEY_DIGEST "digest"
+#else
+#define KEY_DIGEST
+#endif
+
+#define MD5KEY "md5" KEY_DIGEST
+#ifdef __FreeBSD__
+#define RMD160KEY "ripemd160" KEY_DIGEST
+#else
+#define RMD160KEY "rmd160" KEY_DIGEST
+#endif
+#define SHA1KEY "sha1" KEY_DIGEST
+#define SHA256KEY "sha256" KEY_DIGEST
+#define SHA384KEY "sha384"
+#define SHA512KEY "sha512"
#define RP(p) \
((p)->fts_path[0] == '.' && (p)->fts_path[1] == '/' ? \
diff -r d6fd3843b206 -r c9bc5e5b8583 usr.sbin/mtree/spec.c
--- a/usr.sbin/mtree/spec.c Fri Oct 05 00:58:46 2012 +0000
+++ b/usr.sbin/mtree/spec.c Fri Oct 05 00:59:35 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec.c,v 1.80 2012/03/15 02:02:24 joerg Exp $ */
+/* $NetBSD: spec.c,v 1.81 2012/10/05 00:59:35 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: spec.c,v 1.80 2012/03/15 02:02:24 joerg Exp $");
+__RCSID("$NetBSD: spec.c,v 1.81 2012/10/05 00:59:35 christos Exp $");
#endif
#endif /* not lint */
@@ -364,17 +364,22 @@
if (MATCHFLAG(F_CKSUM))
appendfield(pathlast, "cksum=%lu", cur->cksum);
if (MATCHFLAG(F_MD5))
- appendfield(pathlast, "md5=%s", cur->md5digest);
+ appendfield(pathlast, "%s=%s", MD5KEY, cur->md5digest);
if (MATCHFLAG(F_RMD160))
- appendfield(pathlast, "rmd160=%s", cur->rmd160digest);
+ appendfield(pathlast, "%s=%s", RMD160KEY,
+ cur->rmd160digest);
if (MATCHFLAG(F_SHA1))
- appendfield(pathlast, "sha1=%s", cur->sha1digest);
+ appendfield(pathlast, "%s=%s", SHA1KEY,
+ cur->sha1digest);
if (MATCHFLAG(F_SHA256))
- appendfield(pathlast, "sha256=%s", cur->sha256digest);
+ appendfield(pathlast, "%s=%s", SHA256KEY,
+ cur->sha256digest);
if (MATCHFLAG(F_SHA384))
- appendfield(pathlast, "sha384=%s", cur->sha384digest);
+ appendfield(pathlast, "%s=%s", SHA384KEY,
+ cur->sha384digest);
if (MATCHFLAG(F_SHA512))
- appendfield(pathlast, "sha512=%s", cur->sha512digest);
+ appendfield(pathlast, "%s=%s", SHA512KEY,
+ cur->sha512digest);
if (MATCHFLAG(F_FLAGS)) {
str = flags_to_string(cur->st_flags, "none");
appendfield(pathlast, "flags=%s", str);
Home |
Main Index |
Thread Index |
Old Index