Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 22:56:12 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r240766 - projects/mtree/contrib/mtree
Message-ID:  <201209202256.q8KMuCj3009029@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Thu Sep 20 22:56:11 2012
New Revision: 240766
URL: http://svn.freebsd.org/changeset/base/240766

Log:
  Tweak the output to match FreeBSD's mtree when running on FreeBSD systems:
   - Emit ripemd160digest= keywords rather them rmd160=.
   - Output the size of all objects rather than just regular files.
   - Emit the trailing .. when leaving the root directory.

Modified:
  projects/mtree/contrib/mtree/create.c

Modified: projects/mtree/contrib/mtree/create.c
==============================================================================
--- projects/mtree/contrib/mtree/create.c	Thu Sep 20 22:12:50 2012	(r240765)
+++ projects/mtree/contrib/mtree/create.c	Thu Sep 20 22:56:11 2012	(r240766)
@@ -137,8 +137,12 @@ cwalk(void)
 			break;
 		case FTS_DP:
 			if (!nflag && p->fts_level > 0)
-				printf("%*s# %s\n%*s..\n\n", indent, "",
-				    p->fts_path, indent, "");
+				printf("%*s# %s\n", indent, "", p->fts_path);
+#ifndef __FreeBSD__
+			if (p->fts_level > 0)
+#endif
+				printf("%*s..\n\n", indent, "");
+
 			break;
 		case FTS_DNR:
 		case FTS_ERR:
@@ -202,7 +206,11 @@ statf(int indent, FTSENT *p)
 		    (long long)p->fts_statp->st_rdev);
 	if (keys & F_NLINK && p->fts_statp->st_nlink != 1)
 		output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink);
-	if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode))
+	if (keys & F_SIZE
+#ifndef __FreeBSD__
+	    && S_ISREG(p->fts_statp->st_mode)
+#endif
+	    )
 		output(indent, &offset, "size=%lld",
 		    (long long)p->fts_statp->st_size);
 	if (keys & F_TIME)
@@ -233,7 +241,11 @@ statf(int indent, FTSENT *p)
 	if (keys & F_RMD160 && S_ISREG(p->fts_statp->st_mode)) {
 		if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL)
 			mtree_err("%s: RMD160File failed: %s", p->fts_accpath, strerror(errno));
+#ifndef __FreeBSD__
 		output(indent, &offset, "rmd160=%s", digestbuf);
+#else
+		output(indent, &offset, "ripemd160digest=%s", digestbuf);
+#endif
 		free(digestbuf);
 	}
 #endif	/* ! NO_RMD160 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209202256.q8KMuCj3009029>