Deleted Added
full compact
specspec.c (122141) specspec.c (123067)
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Please see src/share/examples/etc/bsd-style-copyright.
6 */
7
8#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Poul-Henning Kamp
3 * All rights reserved.
4 *
5 * Please see src/share/examples/etc/bsd-style-copyright.
6 */
7
8#include <sys/cdefs.h>
9__FBSDID("$FreeBSD: head/usr.sbin/mtree/specspec.c 122141 2003-11-05 22:26:08Z phk $");
9__FBSDID("$FreeBSD: head/usr.sbin/mtree/specspec.c 123067 2003-11-30 18:06:02Z phk $");
10
11#include <err.h>
12#include <grp.h>
13#include <pwd.h>
14#include <stdio.h>
15#include <stdint.h>
16#include <unistd.h>
17#include "mtree.h"

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

66 if (f & F_FLAGS)
67 printf(" flags=%s", flags_to_string(n->st_flags));
68 printf("\n");
69}
70
71static int
72mismatch(NODE *n1, NODE *n2, int differ, char const *path)
73{
10
11#include <err.h>
12#include <grp.h>
13#include <pwd.h>
14#include <stdio.h>
15#include <stdint.h>
16#include <unistd.h>
17#include "mtree.h"

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

66 if (f & F_FLAGS)
67 printf(" flags=%s", flags_to_string(n->st_flags));
68 printf("\n");
69}
70
71static int
72mismatch(NODE *n1, NODE *n2, int differ, char const *path)
73{
74
74 if (n2 == NULL) {
75 shownode(n1, differ, path);
76 return (1);
77 }
78 if (n1 == NULL) {
79 printf("\t");
80 shownode(n2, differ, path);
81 return (1);

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

146walk_in_the_forest(NODE *t1, NODE *t2, char const *path)
147{
148 int r, i;
149 NODE *c1, *c2, *n1, *n2;
150 char *np;
151
152 r = 0;
153
75 if (n2 == NULL) {
76 shownode(n1, differ, path);
77 return (1);
78 }
79 if (n1 == NULL) {
80 printf("\t");
81 shownode(n2, differ, path);
82 return (1);

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

147walk_in_the_forest(NODE *t1, NODE *t2, char const *path)
148{
149 int r, i;
150 NODE *c1, *c2, *n1, *n2;
151 char *np;
152
153 r = 0;
154
154 c1 = t1->child;
155 c2 = t2->child;
155 if (t1 != NULL)
156 c1 = t1->child;
157 else
158 c1 = NULL;
159 if (t2 != NULL)
160 c2 = t2->child;
161 else
162 c2 = NULL;
156 while (c1 != NULL || c2 != NULL) {
157 n1 = n2 = NULL;
158 if (c1 != NULL)
159 n1 = c1->next;
160 if (c2 != NULL)
161 n2 = c2->next;
162 if (c1 != NULL && c2 != NULL) {
163 while (c1 != NULL || c2 != NULL) {
164 n1 = n2 = NULL;
165 if (c1 != NULL)
166 n1 = c1->next;
167 if (c2 != NULL)
168 n2 = c2->next;
169 if (c1 != NULL && c2 != NULL) {
163 i = strcmp(c1->name, c2->name);
164 if (i > 0) {
165 n1 = c1;
166 c1 = NULL;
167 } else if (i < 0) {
170 if (c1->type != F_DIR && c2->type == F_DIR) {
168 n2 = c2;
169 c2 = NULL;
171 n2 = c2;
172 c2 = NULL;
173 } else if (c1->type == F_DIR && c2->type != F_DIR) {
174 n1 = c1;
175 c1 = NULL;
176 } else {
177 i = strcmp(c1->name, c2->name);
178 if (i > 0) {
179 n1 = c1;
180 c1 = NULL;
181 } else if (i < 0) {
182 n2 = c2;
183 c2 = NULL;
184 }
170 }
171 }
172 if (c1 == NULL || c2 == NULL) {
173 i = compare_nodes(c1, c2, path);
174 } else if (c1->child != NULL || c2->child != NULL) {
175 asprintf(&np, "%s%s/", path, c1->name);
176 i = walk_in_the_forest(c1, c2, np);
177 free(np);

--- 24 unchanged lines hidden ---
185 }
186 }
187 if (c1 == NULL || c2 == NULL) {
188 i = compare_nodes(c1, c2, path);
189 } else if (c1->child != NULL || c2->child != NULL) {
190 asprintf(&np, "%s%s/", path, c1->name);
191 i = walk_in_the_forest(c1, c2, np);
192 free(np);

--- 24 unchanged lines hidden ---