add -q flag to silence warnings about symlinks to existing dirs (from OpenBSD

via brooks)
This commit is contained in:
christos 2012-10-05 01:05:14 +00:00
parent 0c2ce7c15d
commit 43c54169be
4 changed files with 29 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.33 2012/10/05 01:01:07 christos Exp $ */
/* $NetBSD: extern.h,v 1.34 2012/10/05 01:05:14 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -70,7 +70,7 @@ const char *rlink(const char *);
int verify(void);
extern int dflag, eflag, iflag, lflag, mflag,
nflag, rflag, sflag, tflag, uflag;
nflag, qflag, 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.56 2012/10/05 01:01:07 christos Exp $
.\" $NetBSD: mtree.8,v 1.57 2012/10/05 01:05:14 christos Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -230,6 +230,12 @@ This is the default.
Use the file hierarchy rooted in
.Ar path ,
instead of the current directory.
.It Fl q
Quiet mode.
Do not complain when a
.Dq missing
directory cannot be created because it already exists.
This occurs when the directory is a symbolic link.
.It Fl R Ar keywords
Remove the specified (whitespace or comma separated) keywords from the current
set of keywords.

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtree.c,v 1.38 2012/10/05 01:01:07 christos Exp $ */
/* $NetBSD: mtree.c,v 1.39 2012/10/05 01:05:14 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.38 2012/10/05 01:01:07 christos Exp $");
__RCSID("$NetBSD: mtree.c,v 1.39 2012/10/05 01:05:14 christos Exp $");
#endif
#endif /* not lint */
@ -60,7 +60,7 @@ __RCSID("$NetBSD: mtree.c,v 1.38 2012/10/05 01:01:07 christos Exp $");
int ftsoptions = FTS_PHYSICAL;
int cflag, Cflag, dflag, Dflag, eflag, iflag, lflag, mflag,
nflag, rflag, sflag, tflag, uflag, Uflag;
nflag, qflag, 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:lLmMnN:p:PrR:s:StuUWxX:"))
"cCdDeE:f:I:ik:K:lLmMnN:p:PqrR:s:StuUWxX:"))
!= -1) {
switch((char)ch) {
case 'c':
@ -148,6 +148,9 @@ main(int argc, char **argv)
ftsoptions &= ~FTS_LOGICAL;
ftsoptions |= FTS_PHYSICAL;
break;
case 'q':
qflag = 1;
break;
case 'r':
rflag = 1;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: verify.c,v 1.40 2012/03/25 16:07:04 christos Exp $ */
/* $NetBSD: verify.c,v 1.41 2012/10/05 01:05:14 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: verify.c,v 1.40 2012/03/25 16:07:04 christos Exp $");
__RCSID("$NetBSD: verify.c,v 1.41 2012/10/05 01:05:14 christos Exp $");
#endif
#endif /* not lint */
@ -175,8 +175,17 @@ miss(NODE *p, char *tail)
if (p->type != F_DIR && (dflag || p->flags & F_VISIT))
continue;
strcpy(tail, p->name);
if (!(p->flags & F_VISIT))
printf("missing: %s", path);
if (!(p->flags & F_VISIT)) {
/* Don't print missing message if file exists as a
symbolic link and the -q flag is set. */
struct stat statbuf;
if (qflag && stat(path, &statbuf) == 0 &&
S_ISDIR(statbuf.st_mode))
p->flags |= F_VISIT;
else
(void)printf("%s missing", path);
}
switch (p->type) {
case F_BLOCK:
case F_CHAR: