summaryrefslogtreecommitdiff
path: root/lib/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/json.c')
-rw-r--r--lib/json.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/json.c b/lib/json.c
index c49a4f9074..ccbecb726a 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -21,6 +21,7 @@
#include <zebra.h>
+#include "command.h"
#include "lib/json.h"
/*
@@ -29,12 +30,12 @@
* what.
*/
int
-use_json (const int argc, const char *argv[])
+use_json (const int argc, struct cmd_token *argv[])
{
if (argc == 0)
return 0;
- if (argv[argc-1] && strcmp(argv[argc-1], "json") == 0)
+ if (argv[argc-1]->arg && strcmp(argv[argc-1]->arg, "json") == 0)
return 1;
return 0;
@@ -86,3 +87,18 @@ json_object_free(struct json_object *obj)
{
json_object_put(obj);
}
+
+#if !defined(HAVE_JSON_C_JSON_H)
+int
+json_object_object_get_ex(struct json_object *obj,
+ const char *key,
+ struct json_object **value)
+{
+ *value = json_object_object_get(obj, key);
+
+ if (*value)
+ return 1;
+
+ return 0;
+}
+#endif