svn commit: r240748 - projects/mtree/contrib/mtree
Brooks Davis
brooks at FreeBSD.org
Thu Sep 20 14:55:33 UTC 2012
Author: brooks
Date: Thu Sep 20 14:55:32 2012
New Revision: 240748
URL: http://svn.freebsd.org/changeset/base/240748
Log:
Implement FreeBSD's -n option which supresses comments.
Modified:
projects/mtree/contrib/mtree/create.c
projects/mtree/contrib/mtree/extern.h
projects/mtree/contrib/mtree/mtree.8
projects/mtree/contrib/mtree/mtree.c
Modified: projects/mtree/contrib/mtree/create.c
==============================================================================
--- projects/mtree/contrib/mtree/create.c Thu Sep 20 14:52:50 2012 (r240747)
+++ projects/mtree/contrib/mtree/create.c Thu Sep 20 14:55:32 2012 (r240748)
@@ -112,9 +112,11 @@ cwalk(void)
"<unknown>";
}
- printf(
- "#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n#\t date: %s",
- user, host, fullpath, ctime(&clocktime));
+ if (!nflag)
+ printf(
+ "#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n"
+ "#\t date: %s",
+ user, host, fullpath, ctime(&clocktime));
if ((t = fts_open(argv, ftsoptions, dcmp)) == NULL)
mtree_err("fts_open: %s", strerror(errno));
@@ -125,12 +127,13 @@ cwalk(void)
}
switch(p->fts_info) {
case FTS_D:
- printf("\n# %s\n", p->fts_path);
+ if (!nflag)
+ printf("\n# %s\n", p->fts_path);
statd(t, p, &uid, &gid, &mode, &flags);
statf(p);
break;
case FTS_DP:
- if (p->fts_level > 0)
+ if (!nflag && p->fts_level > 0)
printf("# %s\n..\n\n", p->fts_path);
break;
case FTS_DNR:
Modified: projects/mtree/contrib/mtree/extern.h
==============================================================================
--- projects/mtree/contrib/mtree/extern.h Thu Sep 20 14:52:50 2012 (r240747)
+++ projects/mtree/contrib/mtree/extern.h Thu Sep 20 14:55:32 2012 (r240748)
@@ -69,7 +69,8 @@ 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 dflag, eflag, iflag, lflag, mflag,
+ nflag, rflag, sflag, tflag, uflag;
extern int mtree_Mflag, mtree_Sflag, mtree_Wflag;
extern size_t mtree_lineno;
extern u_int32_t crc_total;
Modified: projects/mtree/contrib/mtree/mtree.8
==============================================================================
--- projects/mtree/contrib/mtree/mtree.8 Thu Sep 20 14:52:50 2012 (r240747)
+++ projects/mtree/contrib/mtree/mtree.8 Thu Sep 20 14:55:32 2012 (r240748)
@@ -202,6 +202,13 @@ mode).
See
.Xr init 8
for information on security levels.
+.It Fl n
+Do not emit pathname comments when creating a specification.
+Normally
+a comment is emitted before each directory and before the close of that
+directory when using the
+.Fl c
+option.
.It Fl N Ar dbdir
Use the user database text file
.Pa master.passwd
Modified: projects/mtree/contrib/mtree/mtree.c
==============================================================================
--- projects/mtree/contrib/mtree/mtree.c Thu Sep 20 14:52:50 2012 (r240747)
+++ projects/mtree/contrib/mtree/mtree.c Thu Sep 20 14:55:32 2012 (r240748)
@@ -60,7 +60,7 @@ __RCSID("$NetBSD: mtree.c,v 1.37 2011/08
int ftsoptions = FTS_PHYSICAL;
int cflag, Cflag, dflag, Dflag, eflag, iflag, lflag, mflag,
- rflag, sflag, tflag, uflag, Uflag;
+ nflag, rflag, sflag, tflag, uflag, Uflag;
char fullpath[MAXPATHLEN];
__dead2 static void usage(void);
@@ -77,7 +77,7 @@ main(int argc, char **argv)
init_excludes();
while ((ch = getopt(argc, argv,
- "cCdDeE:f:I:ik:K:lLmMN:p:PrR:s:StuUWxX:"))
+ "cCdDeE:f:I:ik:K:lLmMnN:p:PrR:s:StuUWxX:"))
!= -1) {
switch((char)ch) {
case 'c':
@@ -132,6 +132,9 @@ main(int argc, char **argv)
case 'M':
mtree_Mflag = 1;
break;
+ case 'n':
+ nflag = 1;
+ break;
case 'N':
if (! setup_getid(optarg))
mtree_err(
@@ -225,7 +228,7 @@ usage(void)
{
fprintf(stderr,
- "usage: %s [-CcDdeLlMPrSUuWx] [-i|-m] [-E tags] [-f spec]\n"
+ "usage: %s [-CcDdeLlMnPrSUuWx] [-i|-m] [-E tags] [-f spec]\n"
"\t\t[-I tags] [-K keywords] [-k keywords] [-N dbdir] [-p path]\n"
"\t\t[-R keywords] [-s seed] [-X exclude-file]\n",
getprogname());
More information about the svn-src-projects
mailing list