Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mtree add -n flag to disable comments (brook)
details: https://anonhg.NetBSD.org/src/rev/cb64bfd1d5ca
branches: trunk
changeset: 781872:cb64bfd1d5ca
user: christos <christos%NetBSD.org@localhost>
date: Fri Oct 05 01:01:07 2012 +0000
description:
add -n flag to disable comments (brook)
diffstat:
usr.sbin/mtree/create.c | 17 ++++++++++-------
usr.sbin/mtree/extern.h | 5 +++--
usr.sbin/mtree/mtree.8 | 9 ++++++++-
usr.sbin/mtree/mtree.c | 13 ++++++++-----
4 files changed, 29 insertions(+), 15 deletions(-)
diffs (146 lines):
diff -r c9bc5e5b8583 -r cb64bfd1d5ca usr.sbin/mtree/create.c
--- a/usr.sbin/mtree/create.c Fri Oct 05 00:59:35 2012 +0000
+++ b/usr.sbin/mtree/create.c Fri Oct 05 01:01:07 2012 +0000
@@ -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 @@
"<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 @@
}
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:
diff -r c9bc5e5b8583 -r cb64bfd1d5ca usr.sbin/mtree/extern.h
--- a/usr.sbin/mtree/extern.h Fri Oct 05 00:59:35 2012 +0000
+++ b/usr.sbin/mtree/extern.h Fri Oct 05 01:01:07 2012 +0000
@@ -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 @@
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;
diff -r c9bc5e5b8583 -r cb64bfd1d5ca usr.sbin/mtree/mtree.8
--- a/usr.sbin/mtree/mtree.8 Fri Oct 05 00:59:35 2012 +0000
+++ b/usr.sbin/mtree/mtree.8 Fri Oct 05 01:01:07 2012 +0000
@@ -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 @@
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
diff -r c9bc5e5b8583 -r cb64bfd1d5ca usr.sbin/mtree/mtree.c
--- a/usr.sbin/mtree/mtree.c Fri Oct 05 00:59:35 2012 +0000
+++ b/usr.sbin/mtree/mtree.c Fri Oct 05 01:01:07 2012 +0000
@@ -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 @@
#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 @@
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 @@
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 @@
case 'M':
mtree_Mflag = 1;
break;
+ case 'n':
+ nflag = 1;
+ break;
case 'N':
if (! setup_getid(optarg))
mtree_err(
@@ -225,7 +228,7 @@
{
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());
Home |
Main Index |
Thread Index |
Old Index