summaryrefslogtreecommitdiffstats
path: root/utils/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/common.c')
-rw-r--r--utils/common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/common.c b/utils/common.c
index a605f0d..c42ce03 100644
--- a/utils/common.c
+++ b/utils/common.c
@@ -12,6 +12,30 @@
# include "common.h"
+enum JsonResponseFormat
+jsonResponseFormatParse(const char *opt)
+{
+ int i;
+
+
+ if (!opt) {
+ return GB_JSON_MAX;
+ }
+
+ if (strlen (opt) < 2 || opt[0] != '-' || opt[1] != '-') {
+ /*json option is not given*/
+ return GB_JSON_NONE;
+ }
+
+ for (i = 0; i < GB_JSON_MAX; i++) {
+ if (!strcmp(opt, JsonResponseFormatLookup[i])) {
+ return i;
+ }
+ }
+
+ return i;
+}
+
ssize_t
glusterBlockCreateParseSize(const char *dom, char *value)