summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtree
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-07-11 18:42:53 +0000
committeralfred <alfred@FreeBSD.org>2002-07-11 18:42:53 +0000
commit5071cb67d9de457e855d238f7e46baee9a178971 (patch)
tree3e51b873516046d990798f5eea0189b996d75ce7 /usr.sbin/mtree
parentc40ae61c8c183033b215d5e580b876d7f4b55a89 (diff)
downloadFreeBSD-src-5071cb67d9de457e855d238f7e46baee9a178971.zip
FreeBSD-src-5071cb67d9de457e855d238f7e46baee9a178971.tar.gz
fixup for WARNS=4.
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r--usr.sbin/mtree/Makefile2
-rw-r--r--usr.sbin/mtree/compare.c11
-rw-r--r--usr.sbin/mtree/create.c11
-rw-r--r--usr.sbin/mtree/excludes.c2
-rw-r--r--usr.sbin/mtree/extern.h2
-rw-r--r--usr.sbin/mtree/misc.c7
-rw-r--r--usr.sbin/mtree/mtree.c4
-rw-r--r--usr.sbin/mtree/verify.c3
8 files changed, 23 insertions, 19 deletions
diff --git a/usr.sbin/mtree/Makefile b/usr.sbin/mtree/Makefile
index 5b5e03d..e8afa08 100644
--- a/usr.sbin/mtree/Makefile
+++ b/usr.sbin/mtree/Makefile
@@ -7,6 +7,8 @@ PROG= mtree
MAN= mtree.8
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c
+WARNS?= 4
+
.if defined(BOOTSTRAPPING)
.PATH: ${.CURDIR}/../../lib/libc/gen
SRCS+= strtofflags.c
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c
index b2328a6..5393b5d 100644
--- a/usr.sbin/mtree/compare.c
+++ b/usr.sbin/mtree/compare.c
@@ -63,7 +63,7 @@ static const char rcsid[] =
extern int uflag;
extern int lineno;
-static char *ftype(u_int);
+static const char *ftype(u_int);
#define INDENTNAMELEN 8
#define LABEL \
@@ -74,14 +74,15 @@ static char *ftype(u_int);
int
compare(name, s, p)
- char *name;
+ char *name __unused;
register NODE *s;
register FTSENT *p;
{
extern int uflag;
u_long len, val;
int fd, label;
- char *cp, *tab = "";
+ char *cp;
+ const char *tab = "";
char *fflags;
label = 0;
@@ -304,7 +305,7 @@ typeerr: LABEL;
return (label);
}
-char *
+const char *
inotype(type)
u_int type;
{
@@ -329,7 +330,7 @@ inotype(type)
/* NOTREACHED */
}
-static char *
+static const char *
ftype(type)
u_int type;
{
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c
index a7dfc67..3db0502 100644
--- a/usr.sbin/mtree/create.c
+++ b/usr.sbin/mtree/create.c
@@ -89,17 +89,18 @@ cwalk()
{
register FTS *t;
register FTSENT *p;
- time_t clock;
+ time_t cl;
char *argv[2], host[MAXHOSTNAMELEN];
+ char dot[] = ".";
int indent = 0;
- (void)time(&clock);
+ (void)time(&cl);
(void)gethostname(host, sizeof(host));
(void)printf(
"#\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;
if ((t = fts_open(argv, ftsoptions, dsort)) == NULL)
err(1, "line %d: fts_open", lineno);
@@ -208,7 +209,7 @@ statf(indent, p)
output(indent, &offset, "size=%qd", p->fts_statp->st_size);
if (keys & F_TIME)
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);
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
diff --git a/usr.sbin/mtree/excludes.c b/usr.sbin/mtree/excludes.c
index 624b57a..253ef00 100644
--- a/usr.sbin/mtree/excludes.c
+++ b/usr.sbin/mtree/excludes.c
@@ -103,7 +103,7 @@ check_excludes(const char *fname, const char *path)
#define MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0)
LIST_FOREACH(e, &excludes, link) {
- if (e->pathname && MATCH(e->glob, path)
+ if ((e->pathname && MATCH(e->glob, path))
|| MATCH(e->glob, fname))
return 1;
}
diff --git a/usr.sbin/mtree/extern.h b/usr.sbin/mtree/extern.h
index 0805430..68c13aa 100644
--- a/usr.sbin/mtree/extern.h
+++ b/usr.sbin/mtree/extern.h
@@ -39,7 +39,7 @@ int crc(int, u_long *, u_long *);
void cwalk(void);
char *flags_to_string(u_long);
-char *inotype(u_int);
+const char *inotype(u_int);
u_int parsekey(char *, int *);
char *rlink(char *);
NODE *spec(void);
diff --git a/usr.sbin/mtree/misc.c b/usr.sbin/mtree/misc.c
index 151a28b..473adb7 100644
--- a/usr.sbin/mtree/misc.c
+++ b/usr.sbin/mtree/misc.c
@@ -51,7 +51,7 @@ static const char rcsid[] =
extern int lineno;
typedef struct _key {
- char *name; /* key name */
+ const char *name; /* key name */
u_int val; /* value */
#define NEEDVALUE 0x01
@@ -85,13 +85,14 @@ static KEY keylist[] = {
{"uname", F_UNAME, NEEDVALUE},
};
+int keycompare(const void *, const void *);
+
u_int
parsekey(name, needvaluep)
char *name;
int *needvaluep;
{
KEY *k, tmp;
- int keycompare(const void *, const void *);
tmp.name = name;
k = (KEY *)bsearch(&tmp, keylist, sizeof(keylist) / sizeof(KEY),
@@ -108,7 +109,7 @@ int
keycompare(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 *
diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c
index 254c1b6..c2c4710 100644
--- a/usr.sbin/mtree/mtree.c
+++ b/usr.sbin/mtree/mtree.c
@@ -65,9 +65,7 @@ char fullpath[MAXPATHLEN];
static void usage(void);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int ch;
char *dir, *p;
diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c
index 1177f78..d56ee8f 100644
--- a/usr.sbin/mtree/verify.c
+++ b/usr.sbin/mtree/verify.c
@@ -82,8 +82,9 @@ vwalk()
register NODE *ep, *level;
int specdepth, rval;
char *argv[2];
+ char dot[] = ".";
- argv[0] = ".";
+ argv[0] = dot;
argv[1] = NULL;
if ((t = fts_open(argv, ftsoptions, NULL)) == NULL)
err(1, "line %d: fts_open", lineno);
OpenPOWER on IntegriCloud