bug-fileutils
[Top][All Lists]
Advanced

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

Gigabytes support


From: Michal Svec
Subject: Gigabytes support
Date: Tue, 7 Aug 2001 14:49:44 +0200 (CEST)

Hi!

I added support to df and du for displaying gigabytes (-g),
similar to -m. Please, take a look at the attached patch,
I think it is straightforward.

Regards
Michal

--- fileutils-4.1/src/df.c.orig Thu Nov 23 16:13:52 2000
+++ fileutils-4.1/src/df.c      Tue Aug  7 14:42:52 2001
@@ -17,7 +17,9 @@
 
 /* Written by David MacKenzie <address@hidden>.
    --human-readable and --megabyte options added by address@hidden
-   --si and large file support added by address@hidden  */
+   --si and large file support added by address@hidden
+   Gigabyte support by Michal Svec <address@hidden>.
+*/
 
 #ifdef _AIX
  #pragma alloca
@@ -130,6 +132,7 @@
   {"all", no_argument, NULL, 'a'},
   {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
   {"inodes", no_argument, NULL, 'i'},
+  {"gigabytes", no_argument, NULL, 'g'},
   {"human-readable", no_argument, NULL, 'h'},
   {"si", no_argument, NULL, 'H'},
   {"kilobytes", no_argument, NULL, 'k'},
@@ -750,6 +753,7 @@
 \n\
   -a, --all             include filesystems having 0 blocks\n\
       --block-size=SIZE use SIZE-byte blocks\n\
+  -g, --gigabytes       like --block-size=1073741824\n\
   -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 
2G)\n\
   -H, --si              likewise, but use powers of 1000 not 1024\n\
   -i, --inodes          list inode information instead of block usage\n\
@@ -797,7 +801,7 @@
   posix_format = 0;
   exit_status = 0;
 
-  while ((c = getopt_long (argc, argv, "aiF:hHklmPTt:vx:", long_options, NULL))
+  while ((c = getopt_long (argc, argv, "aiF:ghHklmPTt:vx:", long_options, 
NULL))
         != -1)
     {
       switch (c)
@@ -809,6 +813,9 @@
          break;
        case 'i':
          inode_format = 1;
+         break;
+       case 'g':
+         output_block_size = 1024 * 1024 * 1024;
          break;
        case 'h':
          output_block_size = -1024;
--- fileutils-4.1/src/du.c.orig Sat Nov 18 20:54:31 2000
+++ fileutils-4.1/src/du.c      Tue Aug  7 14:42:10 2001
@@ -40,6 +40,7 @@
    By address@hidden, Torbjorn Granlund,
    and address@hidden, David MacKenzie.
    Variable blocks added by address@hidden and address@hidden
+   Gigabyte support by Michal Svec <address@hidden>.
 */
 
 #include <config.h>
@@ -178,6 +179,7 @@
   {"dereference-args", no_argument, NULL, 'D'},
   {"exclude", required_argument, 0, EXCLUDE_OPTION},
   {"exclude-from", required_argument, 0, 'X'},
+  {"gigabytes", no_argument, NULL, 'g'},
   {"human-readable", no_argument, NULL, 'h'},
   {"si", no_argument, 0, 'H'},
   {"kilobytes", no_argument, NULL, 'k'},
@@ -209,6 +211,7 @@
   -b, --bytes           print size in bytes\n\
   -c, --total           produce a grand total\n\
   -D, --dereference-args  dereference PATHs when symbolic link\n\
+  -g, --gigabytes       like --block-size=1073741824\n\
   -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 
2G)\n\
   -H, --si              likewise, but use powers of 1000 not 1024\n\
   -k, --kilobytes       like --block-size=1024\n\
@@ -668,7 +671,7 @@
 
   human_block_size (getenv ("DU_BLOCK_SIZE"), 0, &output_block_size);
 
-  while ((c = getopt_long (argc, argv, "abchHklmsxDLSX:", long_options, NULL))
+  while ((c = getopt_long (argc, argv, "abchgHklmsxDLSX:", long_options, NULL))
         != -1)
     {
       long int tmp_long;
@@ -712,6 +715,10 @@
 
        case 'm':
          output_block_size = 1024 * 1024;
+         break;
+
+       case 'g':
+         output_block_size = 1024 * 1024 * 1024;
          break;
 
        case 'l':




reply via email to

[Prev in Thread] Current Thread [Next in Thread]