Module Name: src Committed By: christos Date: Fri Oct 5 01:05:14 UTC 2012
Modified Files: src/usr.sbin/mtree: extern.h mtree.8 mtree.c verify.c Log Message: add -q flag to silence warnings about symlinks to existing dirs (from OpenBSD via brooks) To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/mtree/extern.h cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/mtree/mtree.8 cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/mtree/mtree.c cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/mtree/verify.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/mtree/extern.h diff -u src/usr.sbin/mtree/extern.h:1.33 src/usr.sbin/mtree/extern.h:1.34 --- src/usr.sbin/mtree/extern.h:1.33 Thu Oct 4 21:01:07 2012 +++ src/usr.sbin/mtree/extern.h Thu Oct 4 21:05:14 2012 @@ -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; Index: src/usr.sbin/mtree/mtree.8 diff -u src/usr.sbin/mtree/mtree.8:1.56 src/usr.sbin/mtree/mtree.8:1.57 --- src/usr.sbin/mtree/mtree.8:1.56 Thu Oct 4 21:01:07 2012 +++ src/usr.sbin/mtree/mtree.8 Thu Oct 4 21:05:14 2012 @@ -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. Index: src/usr.sbin/mtree/mtree.c diff -u src/usr.sbin/mtree/mtree.c:1.38 src/usr.sbin/mtree/mtree.c:1.39 --- src/usr.sbin/mtree/mtree.c:1.38 Thu Oct 4 21:01:07 2012 +++ src/usr.sbin/mtree/mtree.c Thu Oct 4 21:05:14 2012 @@ -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, 19 #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 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; Index: src/usr.sbin/mtree/verify.c diff -u src/usr.sbin/mtree/verify.c:1.40 src/usr.sbin/mtree/verify.c:1.41 --- src/usr.sbin/mtree/verify.c:1.40 Sun Mar 25 12:07:04 2012 +++ src/usr.sbin/mtree/verify.c Thu Oct 4 21:05:14 2012 @@ -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: