mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
Improve spec to spec comparison output.
This commit is contained in:
parent
a0abed18c4
commit
987bbe23e8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130455
@ -81,6 +81,8 @@ mismatch(NODE *n1, NODE *n2, int differ, char const *path)
|
|||||||
shownode(n2, differ, path);
|
shownode(n2, differ, path);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
if (!(differ & keys))
|
||||||
|
return(0);
|
||||||
printf("\t\t");
|
printf("\t\t");
|
||||||
shownode(n1, differ, path);
|
shownode(n1, differ, path);
|
||||||
printf("\t\t");
|
printf("\t\t");
|
||||||
@ -93,6 +95,10 @@ compare_nodes(NODE *n1, NODE *n2, char const *path)
|
|||||||
{
|
{
|
||||||
int differs;
|
int differs;
|
||||||
|
|
||||||
|
if (n1 != NULL && n1->type == F_LINK)
|
||||||
|
n1->flags &= ~F_MODE;
|
||||||
|
if (n2 != NULL && n2->type == F_LINK)
|
||||||
|
n2->flags &= ~F_MODE;
|
||||||
differs = 0;
|
differs = 0;
|
||||||
if (n1 == NULL && n2 != NULL) {
|
if (n1 == NULL && n2 != NULL) {
|
||||||
differs = n2->flags;
|
differs = n2->flags;
|
||||||
@ -184,12 +190,23 @@ walk_in_the_forest(NODE *t1, NODE *t2, char const *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c1 == NULL || c2 == NULL) {
|
if (c1 == NULL && c2->type == F_DIR) {
|
||||||
|
asprintf(&np, "%s%s/", path, c2->name);
|
||||||
|
i = walk_in_the_forest(c1, c2, np);
|
||||||
|
free(np);
|
||||||
i = compare_nodes(c1, c2, path);
|
i = compare_nodes(c1, c2, path);
|
||||||
} else if (c1->child != NULL || c2->child != NULL) {
|
} else if (c2 == NULL && c1->type == F_DIR) {
|
||||||
asprintf(&np, "%s%s/", path, c1->name);
|
asprintf(&np, "%s%s/", path, c1->name);
|
||||||
i = walk_in_the_forest(c1, c2, np);
|
i = walk_in_the_forest(c1, c2, np);
|
||||||
free(np);
|
free(np);
|
||||||
|
i = compare_nodes(c1, c2, path);
|
||||||
|
} else if (c1 == NULL || c2 == NULL) {
|
||||||
|
i = compare_nodes(c1, c2, path);
|
||||||
|
} else if (c1->type == F_DIR && c2->type == F_DIR) {
|
||||||
|
asprintf(&np, "%s%s/", path, c1->name);
|
||||||
|
i = walk_in_the_forest(c1, c2, np);
|
||||||
|
free(np);
|
||||||
|
i = compare_nodes(c1, c2, path);
|
||||||
} else {
|
} else {
|
||||||
i = compare_nodes(c1, c2, path);
|
i = compare_nodes(c1, c2, path);
|
||||||
}
|
}
|
||||||
@ -197,7 +214,6 @@ walk_in_the_forest(NODE *t1, NODE *t2, char const *path)
|
|||||||
c1 = n1;
|
c1 = n1;
|
||||||
c2 = n2;
|
c2 = n2;
|
||||||
}
|
}
|
||||||
i = compare_nodes(t1, t2, path);
|
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +226,7 @@ mtree_specspec(FILE *fi, FILE *fj)
|
|||||||
root1 = mtree_readspec(fi);
|
root1 = mtree_readspec(fi);
|
||||||
root2 = mtree_readspec(fj);
|
root2 = mtree_readspec(fj);
|
||||||
rval = walk_in_the_forest(root1, root2, "");
|
rval = walk_in_the_forest(root1, root2, "");
|
||||||
|
rval += compare_nodes(root1, root2, "");
|
||||||
if (rval > 0)
|
if (rval > 0)
|
||||||
return (MISMATCHEXIT);
|
return (MISMATCHEXIT);
|
||||||
return (0);
|
return (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user