add -n flag to disable comments (brook)

This commit is contained in:
christos 2012-10-05 01:01:07 +00:00
parent 8a1488a16f
commit 0c2ce7c15d
4 changed files with 29 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: create.c,v 1.61 2012/10/05 00:58:46 christos Exp $ */
/* $NetBSD: create.c,v 1.62 2012/10/05 01:01:07 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: create.c,v 1.61 2012/10/05 00:58:46 christos Exp $");
__RCSID("$NetBSD: create.c,v 1.62 2012/10/05 01:01:07 christos Exp $");
#endif
#endif /* not lint */
@ -118,9 +118,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));
@ -131,12 +133,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:

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.32 2011/08/29 20:37:43 joerg Exp $ */
/* $NetBSD: extern.h,v 1.33 2012/10/05 01:01:07 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -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;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mtree.8,v 1.55 2012/10/05 00:59:35 christos Exp $
.\" $NetBSD: mtree.8,v 1.56 2012/10/05 01:01:07 christos Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -203,6 +203,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

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtree.c,v 1.37 2011/08/29 20:37:43 joerg Exp $ */
/* $NetBSD: mtree.c,v 1.38 2012/10/05 01:01:07 christos Exp $ */
/*-
* Copyright (c) 1989, 1990, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: mtree.c,v 1.37 2011/08/29 20:37:43 joerg Exp $");
__RCSID("$NetBSD: mtree.c,v 1.38 2012/10/05 01:01:07 christos Exp $");
#endif
#endif /* not lint */
@ -60,7 +60,7 @@ __RCSID("$NetBSD: mtree.c,v 1.37 2011/08/29 20:37:43 joerg Exp $");
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];
__dead 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());