fixup for WARNS=4.
This commit is contained in:
parent
d89167b4ea
commit
67d357f89b
@ -7,6 +7,8 @@ PROG= mtree
|
|||||||
MAN= mtree.8
|
MAN= mtree.8
|
||||||
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c
|
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c
|
||||||
|
|
||||||
|
WARNS?= 4
|
||||||
|
|
||||||
.if defined(BOOTSTRAPPING)
|
.if defined(BOOTSTRAPPING)
|
||||||
.PATH: ${.CURDIR}/../../lib/libc/gen
|
.PATH: ${.CURDIR}/../../lib/libc/gen
|
||||||
SRCS+= strtofflags.c
|
SRCS+= strtofflags.c
|
||||||
|
@ -63,7 +63,7 @@ static const char rcsid[] =
|
|||||||
extern int uflag;
|
extern int uflag;
|
||||||
extern int lineno;
|
extern int lineno;
|
||||||
|
|
||||||
static char *ftype(u_int);
|
static const char *ftype(u_int);
|
||||||
|
|
||||||
#define INDENTNAMELEN 8
|
#define INDENTNAMELEN 8
|
||||||
#define LABEL \
|
#define LABEL \
|
||||||
@ -74,14 +74,15 @@ static char *ftype(u_int);
|
|||||||
|
|
||||||
int
|
int
|
||||||
compare(name, s, p)
|
compare(name, s, p)
|
||||||
char *name;
|
char *name __unused;
|
||||||
register NODE *s;
|
register NODE *s;
|
||||||
register FTSENT *p;
|
register FTSENT *p;
|
||||||
{
|
{
|
||||||
extern int uflag;
|
extern int uflag;
|
||||||
u_long len, val;
|
u_long len, val;
|
||||||
int fd, label;
|
int fd, label;
|
||||||
char *cp, *tab = "";
|
char *cp;
|
||||||
|
const char *tab = "";
|
||||||
char *fflags;
|
char *fflags;
|
||||||
|
|
||||||
label = 0;
|
label = 0;
|
||||||
@ -304,7 +305,7 @@ typeerr: LABEL;
|
|||||||
return (label);
|
return (label);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
inotype(type)
|
inotype(type)
|
||||||
u_int type;
|
u_int type;
|
||||||
{
|
{
|
||||||
@ -329,7 +330,7 @@ inotype(type)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
ftype(type)
|
ftype(type)
|
||||||
u_int type;
|
u_int type;
|
||||||
{
|
{
|
||||||
|
@ -89,17 +89,18 @@ cwalk()
|
|||||||
{
|
{
|
||||||
register FTS *t;
|
register FTS *t;
|
||||||
register FTSENT *p;
|
register FTSENT *p;
|
||||||
time_t clock;
|
time_t cl;
|
||||||
char *argv[2], host[MAXHOSTNAMELEN];
|
char *argv[2], host[MAXHOSTNAMELEN];
|
||||||
|
char dot[] = ".";
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
|
|
||||||
(void)time(&clock);
|
(void)time(&cl);
|
||||||
(void)gethostname(host, sizeof(host));
|
(void)gethostname(host, sizeof(host));
|
||||||
(void)printf(
|
(void)printf(
|
||||||
"#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n#\t date: %s",
|
"#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n#\t date: %s",
|
||||||
getlogin(), host, fullpath, ctime(&clock));
|
getlogin(), host, fullpath, ctime(&cl));
|
||||||
|
|
||||||
argv[0] = ".";
|
argv[0] = dot;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
if ((t = fts_open(argv, ftsoptions, dsort)) == NULL)
|
if ((t = fts_open(argv, ftsoptions, dsort)) == NULL)
|
||||||
err(1, "line %d: fts_open", lineno);
|
err(1, "line %d: fts_open", lineno);
|
||||||
@ -208,7 +209,7 @@ statf(indent, p)
|
|||||||
output(indent, &offset, "size=%qd", p->fts_statp->st_size);
|
output(indent, &offset, "size=%qd", p->fts_statp->st_size);
|
||||||
if (keys & F_TIME)
|
if (keys & F_TIME)
|
||||||
output(indent, &offset, "time=%ld.%ld",
|
output(indent, &offset, "time=%ld.%ld",
|
||||||
p->fts_statp->st_mtimespec.tv_sec,
|
(long)p->fts_statp->st_mtimespec.tv_sec,
|
||||||
p->fts_statp->st_mtimespec.tv_nsec);
|
p->fts_statp->st_mtimespec.tv_nsec);
|
||||||
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
|
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
|
||||||
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
|
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
|
||||||
|
@ -103,7 +103,7 @@ check_excludes(const char *fname, const char *path)
|
|||||||
#define MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0)
|
#define MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0)
|
||||||
|
|
||||||
LIST_FOREACH(e, &excludes, link) {
|
LIST_FOREACH(e, &excludes, link) {
|
||||||
if (e->pathname && MATCH(e->glob, path)
|
if ((e->pathname && MATCH(e->glob, path))
|
||||||
|| MATCH(e->glob, fname))
|
|| MATCH(e->glob, fname))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ int crc(int, u_long *, u_long *);
|
|||||||
void cwalk(void);
|
void cwalk(void);
|
||||||
char *flags_to_string(u_long);
|
char *flags_to_string(u_long);
|
||||||
|
|
||||||
char *inotype(u_int);
|
const char *inotype(u_int);
|
||||||
u_int parsekey(char *, int *);
|
u_int parsekey(char *, int *);
|
||||||
char *rlink(char *);
|
char *rlink(char *);
|
||||||
NODE *spec(void);
|
NODE *spec(void);
|
||||||
|
@ -51,7 +51,7 @@ static const char rcsid[] =
|
|||||||
extern int lineno;
|
extern int lineno;
|
||||||
|
|
||||||
typedef struct _key {
|
typedef struct _key {
|
||||||
char *name; /* key name */
|
const char *name; /* key name */
|
||||||
u_int val; /* value */
|
u_int val; /* value */
|
||||||
|
|
||||||
#define NEEDVALUE 0x01
|
#define NEEDVALUE 0x01
|
||||||
@ -85,13 +85,14 @@ static KEY keylist[] = {
|
|||||||
{"uname", F_UNAME, NEEDVALUE},
|
{"uname", F_UNAME, NEEDVALUE},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int keycompare(const void *, const void *);
|
||||||
|
|
||||||
u_int
|
u_int
|
||||||
parsekey(name, needvaluep)
|
parsekey(name, needvaluep)
|
||||||
char *name;
|
char *name;
|
||||||
int *needvaluep;
|
int *needvaluep;
|
||||||
{
|
{
|
||||||
KEY *k, tmp;
|
KEY *k, tmp;
|
||||||
int keycompare(const void *, const void *);
|
|
||||||
|
|
||||||
tmp.name = name;
|
tmp.name = name;
|
||||||
k = (KEY *)bsearch(&tmp, keylist, sizeof(keylist) / sizeof(KEY),
|
k = (KEY *)bsearch(&tmp, keylist, sizeof(keylist) / sizeof(KEY),
|
||||||
@ -108,7 +109,7 @@ int
|
|||||||
keycompare(a, b)
|
keycompare(a, b)
|
||||||
const void *a, *b;
|
const void *a, *b;
|
||||||
{
|
{
|
||||||
return (strcmp(((KEY *)a)->name, ((KEY *)b)->name));
|
return (strcmp(((const KEY *)a)->name, ((const KEY *)b)->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -65,9 +65,7 @@ char fullpath[MAXPATHLEN];
|
|||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *dir, *p;
|
char *dir, *p;
|
||||||
|
@ -82,8 +82,9 @@ vwalk()
|
|||||||
register NODE *ep, *level;
|
register NODE *ep, *level;
|
||||||
int specdepth, rval;
|
int specdepth, rval;
|
||||||
char *argv[2];
|
char *argv[2];
|
||||||
|
char dot[] = ".";
|
||||||
|
|
||||||
argv[0] = ".";
|
argv[0] = dot;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
if ((t = fts_open(argv, ftsoptions, NULL)) == NULL)
|
if ((t = fts_open(argv, ftsoptions, NULL)) == NULL)
|
||||||
err(1, "line %d: fts_open", lineno);
|
err(1, "line %d: fts_open", lineno);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user