diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 1998-08-20 20:11:43 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 1998-08-20 20:11:43 +0000 |
commit | df9e58dc6244945b4fb590e7dcc7d03d0c075067 (patch) | |
tree | 2446cc65b5c68e30cb30f9b51156afb1aba180df /usr.sbin/mtree | |
parent | cff7b8faa708e0f716c4c4917e00b605fed09477 (diff) |
add -q flag to silent messages of the type:
missing: some-file-name (not created: File exists)
which occurred of some-file-name was a path that contained a symbolic link
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r-- | usr.sbin/mtree/mtree.8 | 9 | ||||
-rw-r--r-- | usr.sbin/mtree/mtree.c | 11 | ||||
-rw-r--r-- | usr.sbin/mtree/verify.c | 18 |
3 files changed, 27 insertions, 11 deletions
diff --git a/usr.sbin/mtree/mtree.8 b/usr.sbin/mtree/mtree.8 index 74a053bc6cc..4c7db21f583 100644 --- a/usr.sbin/mtree/mtree.8 +++ b/usr.sbin/mtree/mtree.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mtree.8,v 1.7 1997/07/18 05:46:13 millert Exp $ +.\" $OpenBSD: mtree.8,v 1.8 1998/08/20 20:11:39 marc Exp $ .\" $NetBSD: mtree.8,v 1.4 1995/03/07 21:26:25 cgd Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 @@ -42,7 +42,7 @@ .Nd map a directory hierarchy .Sh SYNOPSIS .Nm mtree -.Op Fl cdeinrUux +.Op Fl cdeinqrUux .Op Fl f Ar spec .Op Fl K Ar keywords .Op Fl k Ar keywords @@ -94,6 +94,11 @@ option. Use the file hierarchy rooted in .Ar path , instead of the current directory. +.It Fl q +Quiet mode. Do not complain when a +.Sq missing +directory can not be created because it is already exists. This occurs +when the directory is a symbolic link. .It Fl r Remove any files in the file hierarchy that are not described in the specification. diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c index 7167e63fc3c..c74eeff25a5 100644 --- a/usr.sbin/mtree/mtree.c +++ b/usr.sbin/mtree/mtree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtree.c,v 1.7 1997/07/18 05:49:03 millert Exp $ */ +/* $OpenBSD: mtree.c,v 1.8 1998/08/20 20:11:41 marc Exp $ */ /* $NetBSD: mtree.c,v 1.7 1996/09/05 23:29:22 thorpej Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: mtree.c,v 1.7 1997/07/18 05:49:03 millert Exp $"; +static char rcsid[] = "$OpenBSD: mtree.c,v 1.8 1998/08/20 20:11:41 marc Exp $"; #endif #endif /* not lint */ @@ -60,7 +60,7 @@ static char rcsid[] = "$OpenBSD: mtree.c,v 1.7 1997/07/18 05:49:03 millert Exp $ extern u_int32_t crc_total; int ftsoptions = FTS_PHYSICAL; -int cflag, dflag, eflag, iflag, nflag, rflag, sflag, tflag, uflag, Uflag; +int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, tflag, uflag, Uflag; u_int keys; char fullpath[MAXPATHLEN]; @@ -79,7 +79,7 @@ main(argc, argv) dir = NULL; keys = KEYDEFAULT; - while ((ch = getopt(argc, argv, "cdef:iK:k:np:rs:tUux")) != -1) + while ((ch = getopt(argc, argv, "cdef:iK:k:np:qrs:tUux")) != -1) switch((char)ch) { case 'c': cflag = 1; @@ -114,6 +114,9 @@ main(argc, argv) case 'p': dir = optarg; 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 93cd6a6d076..e32e8259c21 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verify.c,v 1.5 1997/07/18 05:49:04 millert Exp $ */ +/* $OpenBSD: verify.c,v 1.6 1998/08/20 20:11:42 marc Exp $ */ /* $NetBSD: verify.c,v 1.10 1995/03/07 21:26:28 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: verify.c,v 1.5 1997/07/18 05:49:04 millert Exp $"; +static char rcsid[] = "$OpenBSD: verify.c,v 1.6 1998/08/20 20:11:42 marc Exp $"; #endif #endif /* not lint */ @@ -55,7 +55,7 @@ static char rcsid[] = "$OpenBSD: verify.c,v 1.5 1997/07/18 05:49:04 millert Exp extern int32_t crc_total; extern int ftsoptions; -extern int dflag, eflag, rflag, sflag, uflag; +extern int dflag, eflag, qflag, rflag, sflag, uflag; extern char fullpath[MAXPATHLEN]; static NODE *root; @@ -169,8 +169,16 @@ miss(p, tail) if (p->type != F_DIR && (dflag || p->flags & F_VISIT)) continue; (void)strcpy(tail, p->name); - if (!(p->flags & F_VISIT)) - (void)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) + p->flags |= F_VISIT; + else + (void)printf("missing: %s", path); + } if (p->type != F_DIR) { putchar('\n'); continue; |