[coreutils] Support freebsd style bs=1m for 'dd' (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Дмитрий Ильин |
---|---|
Subject: | [coreutils] Support freebsd style bs=1m for 'dd' |
Date: | Sat, 11 Sep 2010 16:02:15 +0400 |
Greetings coreutils developers!
First of all i would like to thank you for the great work you are doing for free software community.
Recently i noticed that coreutils 'dd' doesn't support bs=1m as freebsd user usually type. For example: Freebsd: dd if=/dev/ad0 of=/dev/null bs=1m Linux: dd if=/dev/sda of=/dev/null bs=1M
If i try bs=1m with linux i get dd: invalid number `1m'
I looked into lib/xstrtol.c and found
case 'G': /* giga or gibi */
case 'g': /* 'g' is undocumented; for compatibility only */
overflow = bkm_scale_by_power (&tmp, base, 3);
break;
case 'k': /* kilo */
case 'K': /* kibi */
overflow = bkm_scale_by_power (&tmp, base, 1);
break;
case 'M': /* mega or mebi */
case 'm': /* 'm' is undocumented; for compatibility only */
overflow = bkm_scale_by_power (&tmp, base, 2);
break;
Looks like 'k' and 'K' for kilo, 'g' and 'G' for giga, 'm' and 'M' for mega are all supported.
Then i looked into src/dd.c
enum strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEGkKMPTwYZ0");
'm' letter is missing.
So let's add 'm' letter too. It will be very useful for people who use both freebsd and linux so then will not have to remember should they type 'm' or 'M'. Freebsd users always use 'm'.
--- a/src/dd.c 2010-04-20 23:52:04.000000000 +0400 +++ b/src/dd.c 2010-09-11 15:45:37.721873080 +0400 @@ -968,7 +968,7 @@ { uintmax_t n; char *suffix;
- enum strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEGkKMPTwYZ0");
enum strtol_error e = xstrtoumax (str, &suffix, 10, &n, "bcEGkKmMPTwYZ0");
if (e == LONGINT_INVALID_SUFFIX_CHAR && *suffix == 'x') {
[Prev in Thread] | Current Thread | [Next in Thread] |
---|
- [coreutils] Support freebsd style bs=1m for 'dd',Дмитрий Ильин <=
- Prev by Date:Re: [coreutils] Coreutils Solaris extensions
- Next by Date:[coreutils] [PATCH] join: support multi-byte character encodings
- Previous by thread:[coreutils] Coreutils Solaris extensions
- Next by thread:[coreutils] [PATCH] join: support multi-byte character encodings
- Index(es):