Module Name: src
Committed By: christos
Date: Fri Oct 5 00:59:35 UTC 2012
Modified Files:
src/usr.sbin/mtree: compare.c misc.c mtree.8 mtree.h spec.c
Log Message:
account for differences in digest names
To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/mtree/compare.c \
src/usr.sbin/mtree/mtree.8
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/mtree/misc.c
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/mtree/mtree.h
cvs rdiff -u -r1.80 -r1.81 src/usr.sbin/mtree/spec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/mtree/compare.c
diff -u src/usr.sbin/mtree/compare.c:1.54 src/usr.sbin/mtree/compare.c:1.55
--- src/usr.sbin/mtree/compare.c:1.54 Thu Oct 4 20:42:00 2012
+++ src/usr.sbin/mtree/compare.c Thu Oct 4 20:59:35 2012
@@ -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 @@ typeerr: LABEL;
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 @@ typeerr: LABEL;
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 @@ typeerr: LABEL;
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 @@ typeerr: LABEL;
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 @@ typeerr: LABEL;
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 @@ typeerr: LABEL;
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);
Index: src/usr.sbin/mtree/mtree.8
diff -u src/usr.sbin/mtree/mtree.8:1.54 src/usr.sbin/mtree/mtree.8:1.55
--- src/usr.sbin/mtree/mtree.8:1.54 Wed Oct 3 15:27:48 2012
+++ src/usr.sbin/mtree/mtree.8 Thu Oct 4 20:59:35 2012
@@ -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 @@ The number of hard links the file is exp
.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
Index: src/usr.sbin/mtree/misc.c
diff -u src/usr.sbin/mtree/misc.c:1.30 src/usr.sbin/mtree/misc.c:1.31
--- src/usr.sbin/mtree/misc.c:1.30 Sun Jan 18 07:09:38 2009
+++ src/usr.sbin/mtree/misc.c Thu Oct 4 20:59:35 2012
@@ -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 @@ static KEY keylist[] = {
{"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},
Index: src/usr.sbin/mtree/mtree.h
diff -u src/usr.sbin/mtree/mtree.h:1.27 src/usr.sbin/mtree/mtree.h:1.28
--- src/usr.sbin/mtree/mtree.h:1.27 Sat Apr 4 17:49:49 2009
+++ src/usr.sbin/mtree/mtree.h Thu Oct 4 20:59:35 2012
@@ -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 @@ NODE *spec(FILE *);
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] == '/' ? \
Index: src/usr.sbin/mtree/spec.c
diff -u src/usr.sbin/mtree/spec.c:1.80 src/usr.sbin/mtree/spec.c:1.81
--- src/usr.sbin/mtree/spec.c:1.80 Wed Mar 14 22:02:24 2012
+++ src/usr.sbin/mtree/spec.c Thu Oct 4 20:59:35 2012
@@ -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 @@ dump_nodes(const char *dir, NODE *root,
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);