From 3266e51054fdc1f584bd7a8611c7706e6d0b7cef Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Wed, 4 Nov 2009 18:03:58 +0000 Subject: [PATCH] fish: Allow T for terabyte allocations. --- fish/alloc.c | 7 ++++--- fish/fish.c | 2 ++ guestfish.pod | 8 ++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fish/alloc.c b/fish/alloc.c index e35c02f..3b0de27 100644 --- a/fish/alloc.c +++ b/fish/alloc.c @@ -140,9 +140,10 @@ parse_size (const char *str, off_t *size_rtn) */ if (sscanf (str, "%"SCNu64"%c", &size, &type) == 2) { switch (type) { - case 'k': case 'K': size *= 1024; break; - case 'm': case 'M': size *= 1024 * 1024; break; - case 'g': case 'G': size *= 1024 * 1024 * 1024; break; + case 'k': case 'K': size *= 1024L; break; + case 'm': case 'M': size *= 1024L * 1024; break; + case 'g': case 'G': size *= 1024L * 1024 * 1024; break; + case 't': case 'T': size *= 1024L * 1024 * 1024 * 1024; break; case 's': size *= 512; break; default: fprintf (stderr, _("could not parse size specification '%s'\n"), str); diff --git a/fish/fish.c b/fish/fish.c index 2dfdfb9..1039bad 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -957,6 +957,7 @@ display_builtin_command (const char *cmd) " K or KB number of kilobytes\n" " M or MB number of megabytes\n" " G or GB number of gigabytes\n" + " T or TB number of terabytes\n" " sects number of 512 byte sectors\n")); else if (strcasecmp (cmd, "echo") == 0) printf (_("echo - display a line of text\n" @@ -1047,6 +1048,7 @@ display_builtin_command (const char *cmd) " K or KB number of kilobytes\n" " M or MB number of megabytes\n" " G or GB number of gigabytes\n" + " T or TB number of terabytes\n" " sects number of 512 byte sectors\n")); else if (strcasecmp (cmd, "time") == 0) printf (_("time - measure time taken to run command\n" diff --git a/guestfish.pod b/guestfish.pod index 7755cc6..9b49fe1 100644 --- a/guestfish.pod +++ b/guestfish.pod @@ -453,6 +453,10 @@ number of megabytes number of gigabytes +=item CT or CTB + +number of terabytes + =item Csects number of 512 byte sectors @@ -562,6 +566,10 @@ number of megabytes number of gigabytes +=item CT or CTB + +number of terabytes + =item Csects number of 512 byte sectors -- 1.8.3.1