summaryrefslogtreecommitdiff
path: root/usr.sbin/mtree/compare.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/mtree/compare.c')
-rw-r--r--usr.sbin/mtree/compare.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c
index dcca39f9e9a..5d0c57828a2 100644
--- a/usr.sbin/mtree/compare.c
+++ b/usr.sbin/mtree/compare.c
@@ -1,5 +1,5 @@
/* $NetBSD: compare.c,v 1.11 1996/09/05 09:56:48 mycroft Exp $ */
-/* $OpenBSD: compare.c,v 1.10 1998/05/18 19:10:06 deraadt Exp $ */
+/* $OpenBSD: compare.c,v 1.11 2001/08/10 02:33:46 millert Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: compare.c,v 1.10 1998/05/18 19:10:06 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: compare.c,v 1.11 2001/08/10 02:33:46 millert Exp $";
#endif
#endif /* not lint */
@@ -73,6 +73,15 @@ static char *ftype __P((u_int));
} \
}
+#define REPLACE_COMMA(x) \
+ do { \
+ char *l; \
+ for (l = x; *l; l++) { \
+ if (*l == ',') \
+ *l = ' '; \
+ } \
+ } while (0) \
+
int
compare(name, s, p)
char *name;
@@ -279,6 +288,43 @@ typeerr: LABEL;
LABEL;
(void)printf("%slink ref (%s, %s)\n", tab, cp, s->slink);
}
+ if (s->flags & F_FLAGS && s->file_flags != p->fts_statp->st_flags) {
+ char *db_flags = NULL;
+ char *cur_flags = NULL;
+
+ if ((db_flags = fflagstostr(s->file_flags)) == NULL ||
+ (cur_flags = fflagstostr(p->fts_statp->st_flags)) == NULL) {
+ LABEL;
+ (void)printf("%sflags: %s %s\n", tab, p->fts_accpath,
+ strerror(errno));
+ tab = "\t";
+ if (db_flags != NULL)
+ free(db_flags);
+ if (cur_flags != NULL)
+ free(cur_flags);
+ } else {
+ LABEL;
+ REPLACE_COMMA(db_flags);
+ REPLACE_COMMA(cur_flags);
+ printf("%sflags (%s, %s", tab, (*db_flags == '\0') ?
+ "-" : db_flags,
+ (*cur_flags == '\0') ?
+ "-" : cur_flags);
+ tab = "\t";
+ if (uflag)
+ if (chflags(p->fts_accpath, s->file_flags))
+ (void)printf(", not modified: %s)\n",
+ strerror(errno));
+ else
+ (void)printf(", modified)\n");
+ else
+ (void)printf(")\n");
+ tab = "\t";
+
+ free(db_flags);
+ free(cur_flags);
+ }
+ }
return (label);
}