aboutsummaryrefslogtreecommitdiff
path: root/lib/envop.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/envop.c')
-rw-r--r--lib/envop.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/envop.c b/lib/envop.c
index c685ee2..75d0891 100644
--- a/lib/envop.c
+++ b/lib/envop.c
@@ -71,6 +71,7 @@ environ_free (environ_t *env)
for (i = 0; i < env->env_count; i++)
free (env->env_base[i]);
free (env->env_base);
+ free (env);
}
static ssize_t
@@ -502,4 +503,40 @@ envop_free (struct envop_entry *op)
op = next;
}
}
-
+
+int
+envop_cmp (struct envop_entry *a, struct envop_entry *b)
+{
+ while (a)
+ {
+ if (!b)
+ return 1;
+ if (a->code != b->code)
+ return 1;
+ switch (a->code)
+ {
+ case envop_clear:
+ break;
+
+ case envop_keep:
+ case envop_set:
+ case envop_unset:
+ if (strcmp (a->name, b->name))
+ return 1;
+
+ if (!a->value)
+ {
+ if (b->value)
+ return 1;
+ }
+ else if (!b->value || strcmp (a->value, b->value))
+ return 1;
+ break;
+ }
+ a = a->next;
+ b = b->next;
+ }
+ if (b)
+ return 1;
+ return 0;
+}

Return to:

Send suggestions and report system problems to the System administrator.