[PATCH 5/8] lib/strutils: accept not just 'B' but also lowercase 'b' in a size suffix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just line 'M' and 'm' are accepted for mega, 'G' and 'g' for giga,
'S' and 's' for sectors, and so on.

Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxxxxx>
---
 lib/strutils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/strutils.c b/lib/strutils.c
index 9fe9481..c4f9600 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -101,9 +101,9 @@ int parse_size(const char *str, uintmax_t *res, int *power)
 	 * Check size suffixes
 	 */
 check_suffix:
-	if (*(p + 1) == 'i' && *(p + 2) == 'B' && !*(p + 3))
+	if (*(p + 1) == 'i' && (*(p + 2) == 'B' || *(p + 2) == 'b') && !*(p + 3))
 		base = 1024;			/* XiB, 2^N */
-	else if (*(p + 1) == 'B' && !*(p + 2))
+	else if ((*(p + 1) == 'B' || *(p + 1) == 'b') && !*(p + 2))
 		base = 1000;			/* XB, 10^N */
 	else if (*(p + 1)) {
 		struct lconv const *l = localeconv();
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux