summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtree
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-11-05 20:07:40 +0000
committerphk <phk@FreeBSD.org>2003-11-05 20:07:40 +0000
commitc1f70887cd98e91b587bcd5c639ecb6d38c0c902 (patch)
tree012791d93bb5e7802665c0e4177bdb06d01ded9c /usr.sbin/mtree
parenta88a9d9e80a3590a9fbb80c7d4e9a6ad34e6bbe5 (diff)
downloadFreeBSD-src-c1f70887cd98e91b587bcd5c639ecb6d38c0c902.zip
FreeBSD-src-c1f70887cd98e91b587bcd5c639ecb6d38c0c902.tar.gz
Rename spec() and verify() functions to have mtree_ prefix and take
explicit file descriptor instead of assuming stdin.
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r--usr.sbin/mtree/extern.h4
-rw-r--r--usr.sbin/mtree/mtree.c2
-rw-r--r--usr.sbin/mtree/spec.c13
-rw-r--r--usr.sbin/mtree/verify.c4
4 files changed, 10 insertions, 13 deletions
diff --git a/usr.sbin/mtree/extern.h b/usr.sbin/mtree/extern.h
index 6018a6b..a0059b3 100644
--- a/usr.sbin/mtree/extern.h
+++ b/usr.sbin/mtree/extern.h
@@ -39,8 +39,8 @@ char *flags_to_string(u_long);
const char *inotype(u_int);
u_int parsekey(char *, int *);
char *rlink(char *);
-NODE *spec(void);
-int verify(void);
+NODE *mtree_readspec(FILE *fi);
+int mtree_verifyspec(FILE *fi);
int check_excludes(const char *, const char *);
void init_excludes(void);
diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c
index b858a00..0cc9559 100644
--- a/usr.sbin/mtree/mtree.c
+++ b/usr.sbin/mtree/mtree.c
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
cwalk();
exit(0);
}
- status = verify();
+ status = mtree_verifyspec(stdin);
if (Uflag & (status == MISMATCHEXIT))
status = 0;
exit(status);
diff --git a/usr.sbin/mtree/spec.c b/usr.sbin/mtree/spec.c
index 71038da..1e26559 100644
--- a/usr.sbin/mtree/spec.c
+++ b/usr.sbin/mtree/spec.c
@@ -55,7 +55,7 @@ static void set(char *, NODE *);
static void unset(char *, NODE *);
NODE *
-spec(void)
+mtree_readspec(FILE *fi)
{
NODE *centry, *last;
char *p;
@@ -66,7 +66,7 @@ spec(void)
centry = last = root = NULL;
bzero(&ginfo, sizeof(ginfo));
c_cur = c_next = 0;
- for (lineno = 1; fgets(buf, sizeof(buf), stdin);
+ for (lineno = 1; fgets(buf, sizeof(buf), fi);
++lineno, c_cur = c_next, c_next = 0) {
/* Skip empty lines. */
if (buf[0] == '\n')
@@ -186,21 +186,18 @@ set(char *t, NODE *ip)
break;
case F_MD5:
ip->md5digest = strdup(val);
- if(!ip->md5digest) {
+ if(!ip->md5digest)
errx(1, "strdup");
- }
break;
case F_SHA1:
ip->sha1digest = strdup(val);
- if(!ip->sha1digest) {
+ if(!ip->sha1digest)
errx(1, "strdup");
- }
break;
case F_RMD160:
ip->rmd160digest = strdup(val);
- if(!ip->rmd160digest) {
+ if(!ip->rmd160digest)
errx(1, "strdup");
- }
break;
case F_FLAGS:
if (strcmp("none", val) == 0)
diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c
index c95de38..3f697f6 100644
--- a/usr.sbin/mtree/verify.c
+++ b/usr.sbin/mtree/verify.c
@@ -59,11 +59,11 @@ static void miss(NODE *, char *);
static int vwalk(void);
int
-verify(void)
+mtree_verifyspec(FILE *fi)
{
int rval;
- root = spec();
+ root = mtree_readspec(fi);
rval = vwalk();
miss(root, path);
return (rval);
OpenPOWER on IntegriCloud