diff options
| author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2004-07-31 15:13:08 +0000 |
|---|---|---|
| committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2004-07-31 15:13:08 +0000 |
| commit | 1e1d03d7fc9a41c6b926f2b05d6dd9ca8fa6ecee (patch) | |
| tree | c80ff5d1d249f845da4a7b205d6b23a5030b213a /bin/dd | |
| parent | 809ad9288f874709f772e727c9f582031b8015af (diff) | |
Notes
Diffstat (limited to 'bin/dd')
| -rw-r--r-- | bin/dd/args.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c index 9d87c70b50e2..c4d418b4286f 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -336,14 +336,14 @@ c_conv(const void *a, const void *b) /* * Convert an expression of the following forms to a uintmax_t. * 1) A positive decimal number. - * 2) A positive decimal number followed by a b (mult by 512). - * 3) A positive decimal number followed by a k (mult by 1 << 10). - * 4) A positive decimal number followed by a m (mult by 1 << 20). - * 5) A positive decimal number followed by a g (mult by 1 << 30). - * 5) A positive decimal number followed by a w (mult by sizeof int). - * 6) Two or more positive decimal numbers (with/without [bkmgw]) - * separated by x (also * for backwards compatibility), specifying - * the product of the indicated values. + * 2) A positive decimal number followed by a 'b' or 'B' (mult by 512). + * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10). + * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20). + * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30). + * 5) A positive decimal number followed by a 'w' or 'W' (mult by sizeof int). + * 6) Two or more positive decimal numbers (with/without [BbKkMmGgWw]) + * separated by 'x' or 'X' (also '*' for backwards compatibility), + * specifying the product of the indicated values. */ static uintmax_t get_num(const char *val) @@ -361,18 +361,23 @@ get_num(const char *val) mult = 0; switch (*expr) { + case 'B': case 'b': mult = 512; break; + case 'K': case 'k': mult = 1 << 10; break; + case 'M': case 'm': mult = 1 << 20; break; + case 'G': case 'g': mult = 1 << 30; break; + case 'W': case 'w': mult = sizeof(int); break; @@ -393,6 +398,7 @@ get_num(const char *val) case '\0': break; case '*': /* Backward compatible. */ + case 'X': case 'x': mult = get_num(expr + 1); prevnum = num; @@ -429,18 +435,23 @@ get_off_t(const char *val) mult = 0; switch (*expr) { + case 'B': case 'b': mult = 512; break; + case 'K': case 'k': mult = 1 << 10; break; + case 'M': case 'm': mult = 1 << 20; break; + case 'G': case 'g': mult = 1 << 30; break; + case 'W': case 'w': mult = sizeof(int); break; @@ -459,6 +470,7 @@ get_off_t(const char *val) case '\0': break; case '*': /* Backward compatible. */ + case 'X': case 'x': mult = (intmax_t)get_off_t(expr + 1); prevnum = num; |
