Deleted Added
full compact
specspec.c (133264) specspec.c (144295)
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/usr.sbin/mtree/specspec.c 133264 2004-08-07 10:04:29Z simokawa $");
28__FBSDID("$FreeBSD: head/usr.sbin/mtree/specspec.c 144295 2005-03-29 11:44:17Z tobez $");
29
30#include <err.h>
31#include <grp.h>
32#include <pwd.h>
33#include <stdio.h>
34#include <stdint.h>
35#include <unistd.h>
36#include "mtree.h"

--- 40 unchanged lines hidden (view full) ---

77 printf(" uname=%s", pw->pw_name);
78 }
79 if (f & F_MD5)
80 printf(" md5digest=%s", n->md5digest);
81 if (f & F_SHA1)
82 printf(" sha1digest=%s", n->sha1digest);
83 if (f & F_RMD160)
84 printf(" rmd160digest=%s", n->rmd160digest);
29
30#include <err.h>
31#include <grp.h>
32#include <pwd.h>
33#include <stdio.h>
34#include <stdint.h>
35#include <unistd.h>
36#include "mtree.h"

--- 40 unchanged lines hidden (view full) ---

77 printf(" uname=%s", pw->pw_name);
78 }
79 if (f & F_MD5)
80 printf(" md5digest=%s", n->md5digest);
81 if (f & F_SHA1)
82 printf(" sha1digest=%s", n->sha1digest);
83 if (f & F_RMD160)
84 printf(" rmd160digest=%s", n->rmd160digest);
85 if (f & F_SHA256)
86 printf(" sha256digest=%s", n->sha256digest);
85 if (f & F_FLAGS)
86 printf(" flags=%s", flags_to_string(n->st_flags));
87 printf("\n");
88}
89
90static int
91mismatch(NODE *n1, NODE *n2, int differ, char const *path)
92{

--- 62 unchanged lines hidden (view full) ---

155 if (FF(n1, n2, F_UNAME, st_uid))
156 differs |= F_UNAME;
157 if (FS(n1, n2, F_MD5, md5digest))
158 differs |= F_MD5;
159 if (FS(n1, n2, F_SHA1, sha1digest))
160 differs |= F_SHA1;
161 if (FS(n1, n2, F_RMD160, rmd160digest))
162 differs |= F_RMD160;
87 if (f & F_FLAGS)
88 printf(" flags=%s", flags_to_string(n->st_flags));
89 printf("\n");
90}
91
92static int
93mismatch(NODE *n1, NODE *n2, int differ, char const *path)
94{

--- 62 unchanged lines hidden (view full) ---

157 if (FF(n1, n2, F_UNAME, st_uid))
158 differs |= F_UNAME;
159 if (FS(n1, n2, F_MD5, md5digest))
160 differs |= F_MD5;
161 if (FS(n1, n2, F_SHA1, sha1digest))
162 differs |= F_SHA1;
163 if (FS(n1, n2, F_RMD160, rmd160digest))
164 differs |= F_RMD160;
165 if (FS(n1, n2, F_SHA256, sha256digest))
166 differs |= F_SHA256;
163 if (FF(n1, n2, F_FLAGS, st_flags))
164 differs |= F_FLAGS;
165 if (differs) {
166 mismatch(n1, n2, differs, path);
167 return (1);
168 }
169 return (0);
170}

--- 37 unchanged lines hidden (view full) ---

208 c2 = NULL;
209 }
210 }
211 }
212 if (c1 == NULL && c2->type == F_DIR) {
213 asprintf(&np, "%s%s/", path, c2->name);
214 i = walk_in_the_forest(c1, c2, np);
215 free(np);
167 if (FF(n1, n2, F_FLAGS, st_flags))
168 differs |= F_FLAGS;
169 if (differs) {
170 mismatch(n1, n2, differs, path);
171 return (1);
172 }
173 return (0);
174}

--- 37 unchanged lines hidden (view full) ---

212 c2 = NULL;
213 }
214 }
215 }
216 if (c1 == NULL && c2->type == F_DIR) {
217 asprintf(&np, "%s%s/", path, c2->name);
218 i = walk_in_the_forest(c1, c2, np);
219 free(np);
216 i = compare_nodes(c1, c2, path);
220 i += compare_nodes(c1, c2, path);
217 } else if (c2 == NULL && c1->type == F_DIR) {
218 asprintf(&np, "%s%s/", path, c1->name);
219 i = walk_in_the_forest(c1, c2, np);
220 free(np);
221 } else if (c2 == NULL && c1->type == F_DIR) {
222 asprintf(&np, "%s%s/", path, c1->name);
223 i = walk_in_the_forest(c1, c2, np);
224 free(np);
221 i = compare_nodes(c1, c2, path);
225 i += compare_nodes(c1, c2, path);
222 } else if (c1 == NULL || c2 == NULL) {
223 i = compare_nodes(c1, c2, path);
224 } else if (c1->type == F_DIR && c2->type == F_DIR) {
225 asprintf(&np, "%s%s/", path, c1->name);
226 i = walk_in_the_forest(c1, c2, np);
227 free(np);
226 } else if (c1 == NULL || c2 == NULL) {
227 i = compare_nodes(c1, c2, path);
228 } else if (c1->type == F_DIR && c2->type == F_DIR) {
229 asprintf(&np, "%s%s/", path, c1->name);
230 i = walk_in_the_forest(c1, c2, np);
231 free(np);
228 i = compare_nodes(c1, c2, path);
232 i += compare_nodes(c1, c2, path);
229 } else {
230 i = compare_nodes(c1, c2, path);
231 }
232 r += i;
233 c1 = n1;
234 c2 = n2;
235 }
236 return (r);

--- 16 unchanged lines hidden ---
233 } else {
234 i = compare_nodes(c1, c2, path);
235 }
236 r += i;
237 c1 = n1;
238 c2 = n2;
239 }
240 return (r);

--- 16 unchanged lines hidden ---