diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-12-11 22:16:31 -0600 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-12-13 11:46:56 -0700 |
commit | 2598090b7e17f8bdca95b22e7f27217054730e02 (patch) | |
tree | 08c613d02581cdf4238736511cc10d5f3c782990 /lib | |
parent | e080d545f8ffb104a13b07deddf92ecb498b3a94 (diff) |
env: Add environment variable flags
Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.
If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hashtable.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/hashtable.c b/lib/hashtable.c index e9226665f34..07ebfb218f8 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -55,6 +55,7 @@ #endif #include <env_callback.h> +#include <env_flags.h> #include <search.h> /* @@ -412,6 +413,8 @@ int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval, /* This is a new entry, so look up a possible callback */ env_callback_init(&htab->table[idx].entry); + /* Also look for flags */ + env_flags_init(&htab->table[idx].entry); /* check for permission */ if (htab->change_ok != NULL && htab->change_ok( @@ -465,6 +468,7 @@ static void _hdelete(const char *key, struct hsearch_data *htab, ENTRY *ep, free((void *)ep->key); free(ep->data); ep->callback = NULL; + ep->flags = 0; htab->table[idx].used = -1; --htab->filled; |