diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-02-03 18:34:07 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-02-05 20:54:47 +0530 |
commit | bbcbaf494ad406ceea4f0175b91cf67966d32a27 (patch) | |
tree | a7711627b787d9be66bc5c57513095e3aa1eb3b9 /utils.c | |
parent | acd4965776507abe1102b3a2bfa5ed9cd0340e14 (diff) |
cli: deprecated getopts_long usage
deprecated getopts as to eliminate use of '--' with command line options
The new usage looks like:
gluster-block (Version 0.1)
create <name> Create the gluster block
volserver [gluster-node] node addr from gluster pool(def: localhost)
size <size> block storage size in KiB|MiB|GiB|TiB..
mpath <count> multi path requirement for high availablity
servers [<IP1,IP2,IP3...>] block servers, clubbed with any option
list List available gluster blocks
info <name> Details about gluster block
modify <resize|auth> Modify the metadata
delete <name> Delete the gluster block
volume <vol> gluster volume name
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -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; |