[PATCH 18/19] mkfs: unit conversions are case insensitive

jtulak
2016-03-24T11:15:57Z

From: Jan Tulak <jtulak@redhat.com>

Solves the question "Should I use 10g or 10G?"

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
mkfs/xfs_mkfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 2bb3b35..680c6c4 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3625,17 +3625,17 @@ cvtnum(
if (*sp == 's' && sp[1] == '\0')
return i * sectsize;

- if (*sp == 'k' && sp[1] == '\0')
+ if ((*sp == 'k' || *sp == 'K' ) && sp[1] == '\0')
return 1024LL * i;
- if (*sp == 'm' && sp[1] == '\0')
+ if ((*sp == 'm' || *sp == 'M' ) && sp[1] == '\0')
return 1024LL * 1024LL * i;
- if (*sp == 'g' && sp[1] == '\0')
+ if ((*sp == 'g' || *sp == 'G' ) && sp[1] == '\0')
return 1024LL * 1024LL * 1024LL * i;
- if (*sp == 't' && sp[1] == '\0')
+ if ((*sp == 't' || *sp == 'T' ) && sp[1] == '\0')
return 1024LL * 1024LL * 1024LL * 1024LL * i;
- if (*sp == 'p' && sp[1] == '\0')
+ if ((*sp == 'p' || *sp == 'P' ) && sp[1] == '\0')
return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
- if (*sp == 'e' && sp[1] == '\0')
+ if ((*sp == 'e' || *sp == 'E' ) && sp[1] == '\0')
return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
return -1LL;
}
--
2.6.0