summaryrefslogtreecommitdiff
path: root/usr.sbin/mtree/create.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-08-10 02:33:47 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-08-10 02:33:47 +0000
commit5750940275ee45e548ad1a04573ecc745d6bb077 (patch)
tree796a18be9775928c677a6b28349a057627e43159 /usr.sbin/mtree/create.c
parent9dfada6aaa5bbdeae95706bad70116b9ea08fa7a (diff)
Add file flag support to mtree from henning@crackinghacking.de
with man page update and minor tweaks by me.
Diffstat (limited to 'usr.sbin/mtree/create.c')
-rw-r--r--usr.sbin/mtree/create.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c
index 26e046aa6a1..12a2ab0fdaa 100644
--- a/usr.sbin/mtree/create.c
+++ b/usr.sbin/mtree/create.c
@@ -1,5 +1,5 @@
/* $NetBSD: create.c,v 1.11 1996/09/05 09:24:19 mycroft Exp $ */
-/* $OpenBSD: create.c,v 1.11 1997/11/05 20:31:26 flipk Exp $ */
+/* $OpenBSD: create.c,v 1.12 2001/08/10 02:33:46 millert Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: create.c,v 1.11 1997/11/05 20:31:26 flipk Exp $";
+static char rcsid[] = "$OpenBSD: create.c,v 1.12 2001/08/10 02:33:46 millert Exp $";
#endif
#endif /* not lint */
@@ -227,6 +227,18 @@ statf(indent, p)
if (keys & F_SLINK &&
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE))
output(indent, &offset, "link=%s", rlink(p->fts_accpath));
+ if (keys & F_FLAGS && !S_ISLNK(p->fts_statp->st_mode)) {
+ char *file_flags;
+
+ file_flags = fflagstostr(p->fts_statp->st_flags);
+ if (file_flags == NULL)
+ error("%s", strerror(errno));
+ if (*file_flags != '\0')
+ output(indent, &offset, "flags=%s", file_flags);
+ else
+ output(indent, &offset, "flags=none");
+ free(file_flags);
+ }
(void)putchar('\n');
}