* Copyright (c) 1989 The Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
static char sccsid
[] = "@(#)compare.c 5.10 (Berkeley) 3/31/92";
static char *ftype
__P((u_int
));
len = printf("%s: ", RP(p)); \
if (len > INDENTNAMELEN) { \
(void)printf("%*s", INDENTNAMELEN - len, ""); \
if (!S_ISBLK(p
->fts_statp
->st_mode
))
if (!S_ISCHR(p
->fts_statp
->st_mode
))
if (!S_ISDIR(p
->fts_statp
->st_mode
))
if (!S_ISFIFO(p
->fts_statp
->st_mode
))
if (!S_ISREG(p
->fts_statp
->st_mode
))
if (!S_ISLNK(p
->fts_statp
->st_mode
))
if (!S_ISSOCK(p
->fts_statp
->st_mode
)) {
(void)printf("\ttype (%s, %s)\n",
ftype(s
->type
), inotype(p
->fts_statp
->st_mode
));
/* Set the uid/gid first, then set the mode. */
if (s
->flags
& (F_UID
| F_UNAME
) && s
->st_uid
!= p
->fts_statp
->st_uid
) {
(void)printf("%suser (%u, %u",
tab
, s
->st_uid
, p
->fts_statp
->st_uid
);
if (chown(p
->fts_accpath
, s
->st_uid
, -1))
(void)printf(", not modified: %s)\n",
(void)printf(", modified)\n");
if (s
->flags
& (F_GID
| F_GNAME
) && s
->st_gid
!= p
->fts_statp
->st_gid
) {
(void)printf("%sgid (%u, %u",
tab
, s
->st_gid
, p
->fts_statp
->st_gid
);
if (chown(p
->fts_accpath
, -1, s
->st_gid
))
(void)printf(", not modified: %s)",
(void)printf(", modified)");
s
->st_mode
!= (p
->fts_statp
->st_mode
& MBITS
)) {
(void)printf("%spermissions (%#o, %#o",
tab
, s
->st_mode
, p
->fts_statp
->st_mode
& MBITS
);
if (chmod(p
->fts_accpath
, s
->st_mode
))
(void)printf(", not modified: %s)",
(void)printf(", modified)");
if (s
->flags
& F_NLINK
&& s
->type
!= F_DIR
&&
s
->st_nlink
!= p
->fts_statp
->st_nlink
) {
(void)printf("%slink count (%u, %u)\n",
tab
, s
->st_nlink
, p
->fts_statp
->st_nlink
);
if (s
->flags
& F_SIZE
&& s
->st_size
!= p
->fts_statp
->st_size
) {
(void)printf("%ssize (%ld, %ld)\n",
tab
, s
->st_size
, p
->fts_statp
->st_size
);
if (s
->flags
& F_TIME
&& s
->st_mtime
!= p
->fts_statp
->st_mtime
) {
(void)printf("%smodification time (%.24s, ",
tab
, ctime(&s
->st_mtime
));
(void)printf("%.24s)\n", ctime(&p
->fts_statp
->st_mtime
));
if ((fd
= open(p
->fts_accpath
, O_RDONLY
, 0)) < 0) {
(void)printf("%scksum: %s: %s\n",
tab
, p
->fts_accpath
, strerror(errno
));
} else if (crc(fd
, &val
, &len
)) {
(void)printf("%scksum: %s: %s\n",
tab
, p
->fts_accpath
, strerror(errno
));
(void)printf("%scksum (%lu, %lu)\n",
if (s
->flags
& F_SLINK
&& strcmp(cp
= rlink(name
), s
->slink
)) {
(void)printf("%slink ref (%s, %s)\n", tab
, cp
, s
->slink
);
static char lbuf
[MAXPATHLEN
];
if ((len
= readlink(name
, lbuf
, sizeof(lbuf
))) == -1)
err("%s: %s", name
, strerror(errno
));