* Copyright (c) 1990 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)verify.c 5.8 (Berkeley) %G%";
static char path
[MAXPATHLEN
];
extern int ftsoptions
, dflag
, eflag
, rflag
;
register NODE
*ep
, *level
;
int ftsdepth
= 0, specdepth
= 0;
if (!(t
= fts_open(argv
, ftsoptions
, (int (*)())NULL
))) {
"mtree: fts_open: %s.\n", strerror(errno
));
while (p
= fts_read(t
)) {
if (!strcmp(p
->fts_name
, "."))
"mtree: directory cycle: %s.\n", RP(p
));
"mtree: %s: unable to read or search.\n", RP(p
));
if (specdepth
> ftsdepth
) {
for (level
= level
->parent
; level
->prev
;
(void)fprintf(stderr
, "mtree: %s: %s.\n",
"mtree: can't stat: %s.\n", RP(p
));
for (ep
= level
; ep
; ep
= ep
->next
)
if (ep
->flags
& F_MAGIC
&& fnmatch(ep
->name
,
p
->fts_name
, FNM_PATHNAME
|FNM_QUOTE
) ||
!strcmp(ep
->name
, p
->fts_name
)) {
(void)fts_set(t
, p
, FTS_SKIP
);
compare(ep
->name
, ep
, p
);
if (ep
->child
&& ep
->type
== F_DIR
&&
(void)printf("extra: %s", RP(p
));
if (unlink(p
->fts_accpath
)) {
(void)printf(", not removed: %s",
(void)printf(", removed");
(void)fts_set(t
, p
, FTS_SKIP
);
if (p
->type
!= F_DIR
&& (dflag
|| p
->flags
& F_VISIT
))
(void)strcpy(tail
, p
->name
);
if (!(p
->flags
& F_VISIT
))
(void)printf("missing: %s", path
);
if (!(p
->flags
& F_VISIT
) && uflag
)
#define MINBITS (F_GROUP|F_MODE|F_OWNER)
if ((p
->flags
& MINBITS
) != MINBITS
)
(void)printf(" (not created -- group, mode or owner not specified)");
else if (mkdir(path
, S_IRWXU
))
(void)printf(" (not created: %s)",
(void)printf(" (created)");
if (!(p
->flags
& F_VISIT
))
for (tp
= tail
; *tp
; ++tp
);
if (chown(path
, p
->st_uid
, p
->st_gid
)) {
(void)printf("%s: owner/group/mode not modified: %s\n",
if (chmod(path
, p
->st_mode
))
(void)printf("%s: permissions not set: %s\n",