diff --git a/usr.sbin/mtree/extern.h b/usr.sbin/mtree/extern.h index 8e4e55793477..fa010ef5ed64 100644 --- a/usr.sbin/mtree/extern.h +++ b/usr.sbin/mtree/extern.h @@ -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; diff --git a/usr.sbin/mtree/mtree.8 b/usr.sbin/mtree/mtree.8 index aafce95c24f7..83a949405845 100644 --- a/usr.sbin/mtree/mtree.8 +++ b/usr.sbin/mtree/mtree.8 @@ -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. diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c index 102a261f73cb..ae984686d304 100644 --- a/usr.sbin/mtree/mtree.c +++ b/usr.sbin/mtree/mtree.c @@ -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; diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c index 5c2eee577ab7..fc8825ee7ab0 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -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: