diff options
| author | Michael Adam <obnox@redhat.com> | 2017-12-20 13:29:03 +0100 | 
|---|---|---|
| committer | Michael Adam <obnox@redhat.com> | 2017-12-21 08:19:58 +0100 | 
| commit | f03d6410625c2a606904e8bafb7096181ea9b5a0 (patch) | |
| tree | 0e27e6a36cf9c1894b45ac5f9034f419d4be7ddb /utils | |
| parent | 566627a3d3c91b3359f1da5fda00d528e18aae37 (diff) | |
cli: make unit prefixes case insensitive
Change-Id: I28544d08217f15b90c3e439bfd9aa75ba0432d07
Signed-off-by: Michael Adam <obnox@redhat.com>
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/common.c | 20 | ||||
| -rw-r--r-- | utils/utils.h | 1 | 
2 files changed, 10 insertions, 11 deletions
diff --git a/utils/common.c b/utils/common.c index 4b9237f..98cc0ef 100644 --- a/utils/common.c +++ b/utils/common.c @@ -59,33 +59,31 @@ glusterBlockParseSize(const char *dom, char *value)      tmp = tmp + 1;    } -  switch (*tmp) { -  case 'Y': +  switch (tolower(*tmp)) { +  case 'y':      sizef *= 1024;      /* fall through */ -  case 'Z': +  case 'z':      sizef *= 1024;      /* fall through */ -  case 'E': +  case 'e':      sizef *= 1024;      /* fall through */ -  case 'P': +  case 'p':      sizef *= 1024;      /* fall through */ -  case 'T': +  case 't':      sizef *= 1024;      /* fall through */ -  case 'G': +  case 'g':      sizef *= 1024;      /* fall through */ -  case 'M': +  case 'm':      sizef *= 1024;      /* fall through */ -  case 'K':    case 'k':      sizef *= 1024;      /* fall through */ -  case 'B':    case 'b':    case '\0':      break; @@ -106,7 +104,7 @@ glusterBlockParseSize(const char *dom, char *value)  fail:    LOG(dom, GB_LOG_ERROR, "%s",        "Unknown size unit. " -      "You may use b/B, k/K(iB), M(iB), G(iB), and T(iB) suffixes for " +      "You may use b/B, k/K(iB), m/M(iB), g/G(iB), and t/T(iB) suffixes for "        "bytes, kibibytes, mebibytes, gibibytes, and tebibytes.");    return -1;  } diff --git a/utils/utils.h b/utils/utils.h index bd073ad..8a30d25 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -24,6 +24,7 @@  # include  <time.h>  # include  <limits.h>  # include  <sys/time.h> +# include  <ctype.h>  # define  GB_LOGDIR              DATADIR "/log/gluster-block"  # define  GB_INFODIR             DATADIR "/run"  | 
