From bdd34cca13be8ac075657b3981f6db91f7dab0ae Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Wed, 28 Sep 2016 14:56:30 +1000 Subject: nvram: add nvram_query_eq() Adds a helper that looks for the given NVRAM config string and checks that associated value is equal to the supplied value. Signed-off-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- core/nvram-format.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core') diff --git a/core/nvram-format.c b/core/nvram-format.c index b98aee1..b110d80 100644 --- a/core/nvram-format.c +++ b/core/nvram-format.c @@ -262,3 +262,14 @@ const char *nvram_query(const char *key) return NULL; } + + +bool nvram_query_eq(const char *key, const char *value) +{ + const char *s = nvram_query(key); + + if (!s) + return false; + + return !strcmp(s, value); +} -- cgit v1.1