summaryrefslogtreecommitdiff
path: root/lib/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/json.c')
-rw-r--r--lib/json.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/json.c b/lib/json.c
index 07b70e4f06..f78bfcd844 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -19,8 +19,26 @@
* 02111-1307, USA.
*/
+#include <string.h>
#include "lib/json.h"
+/*
+ * This function assumes that the json keyword
+ * is the *last* keyword on the line no matter
+ * what.
+ */
+int
+use_json (const int argc, const char *argv[])
+{
+ if (argc == 0)
+ return 0;
+
+ if (argv[argc-1] && strcmp(argv[argc-1], "json") == 0)
+ return 1;
+
+ return 0;
+}
+
void
json_object_string_add(struct json_object* obj, const char *key,
const char *s)