summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-11-04 18:03:58 +0000
committerRichard Jones <rjones@redhat.com>2009-11-04 18:03:58 +0000
commit3266e51054fdc1f584bd7a8611c7706e6d0b7cef (patch)
tree93639c2e10dde66689b0a4610eb4dab558218439
parent5ce72e039ca332ba19bb9122b7c93d257e745bb5 (diff)
downloadlibguestfs-3266e51054fdc1f584bd7a8611c7706e6d0b7cef.tar.gz
libguestfs-3266e51054fdc1f584bd7a8611c7706e6d0b7cef.tar.xz
libguestfs-3266e51054fdc1f584bd7a8611c7706e6d0b7cef.zip
fish: Allow <nn>T for terabyte allocations.
-rw-r--r--fish/alloc.c7
-rw-r--r--fish/fish.c2
-rw-r--r--guestfish.pod8
3 files changed, 14 insertions, 3 deletions
diff --git a/fish/alloc.c b/fish/alloc.c
index e35c02f7..3b0de27e 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 2dfdfb92..1039bada 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -957,6 +957,7 @@ display_builtin_command (const char *cmd)
" <nn>K or <nn>KB number of kilobytes\n"
" <nn>M or <nn>MB number of megabytes\n"
" <nn>G or <nn>GB number of gigabytes\n"
+ " <nn>T or <nn>TB number of terabytes\n"
" <nn>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)
" <nn>K or <nn>KB number of kilobytes\n"
" <nn>M or <nn>MB number of megabytes\n"
" <nn>G or <nn>GB number of gigabytes\n"
+ " <nn>T or <nn>TB number of terabytes\n"
" <nn>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 7755cc62..9b49fe15 100644
--- a/guestfish.pod
+++ b/guestfish.pod
@@ -453,6 +453,10 @@ number of megabytes
number of gigabytes
+=item C<nn>T or C<nn>TB
+
+number of terabytes
+
=item C<nn>sects
number of 512 byte sectors
@@ -562,6 +566,10 @@ number of megabytes
number of gigabytes
+=item C<nn>T or C<nn>TB
+
+number of terabytes
+
=item C<nn>sects
number of 512 byte sectors