summaryrefslogtreecommitdiffstats
path: root/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index ee3515f..059fb6b 100644
--- a/utils.c
+++ b/utils.c
@@ -14,6 +14,65 @@
int
+glusterBlockCLIOptEnumParse(const char *opt)
+{
+ int i;
+
+
+ if (!opt) {
+ return GB_CLI_OPT_MAX;
+ }
+
+ for (i = 0; i < GB_CLI_OPT_MAX; i++) {
+ if (!strcmp(opt, gbCmdlineOptLookup[i])) {
+ return i;
+ }
+ }
+
+ return i;
+}
+
+int
+glusterBlockCLICreateOptEnumParse(const char *opt)
+{
+ int i;
+
+
+ if (!opt) {
+ return GB_CLI_CREATE_OPT_MAX;
+ }
+
+ /* i = 11, enum start look gbCmdlineCreateOption */
+ for (i = 11; i < GB_CLI_CREATE_OPT_MAX; i++) {
+ if (!strcmp(opt, gbCmdlineCreateOptLookup[i])) {
+ return i;
+ }
+ }
+
+ return i;
+}
+
+int
+glusterBlockCLICommonOptEnumParse(const char *opt)
+{
+ int i;
+
+
+ if (!opt) {
+ return GB_CLI_COMMON_OPT_MAX;
+ }
+
+ /* i = 21, enum start look gbCmdlineCreateOption */
+ for (i = 21; i < GB_CLI_COMMON_OPT_MAX; i++) {
+ if (!strcmp(opt, gbCmdlineCommonOptLookup[i])) {
+ return i;
+ }
+ }
+
+ return i;
+}
+
+int
blockMetaKeyEnumParse(const char *opt)
{
int i;