bug-coreutils
[Top][All Lists]
Advanced

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

bug#11858: df -m undocumented, why no df -g


From: Bernhard Voelker
Subject: bug#11858: df -m undocumented, why no df -g
Date: Wed, 11 Jul 2012 17:35:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120601 Thunderbird/13.0


On 07/05/2012 05:08 PM, Jim Meyering wrote:
> Bernhard Voelker wrote:
>> On 07/05/2012 02:35 PM, Jim Meyering wrote:
>>> However, I'm tempted to remove it directly this time, since it's been
>>> undocumented for a while:
>>>
>>>   5 years in df.1 and df --help: COREUTILS-6_9-151-g1e07a21
>>>   11 years in coreutils.texi: FILEUTILS-4_1_4-28-gf5bf6fe
>>>
>>> What do you think?
>>
>> I agree, the option has been added to df in 1996, and declared
>> obsolescent in 2001, so the period since the latter is twice as
>> long as the active use.
>>
>> And it's very easy to s/--megabytes/-BM/ ...
> 
> More important than 2001 is the year in which we removed
> the reference from the man page and from --help: 2007

You're right. Then what about a deprecation warning and removing
the long option in 2013?

P.S. Make "syntax-check" doesn't find the offender against
sc_error_message_uppercase for the "Warning:" message when
(mount_list == NULL) in df.c

Have a nice day,
Berny


>From 750cd181cf87160b11556f92bd098ba535780ffc Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Wed, 11 Jul 2012 17:27:20 +0200
Subject: [PATCH] df: Warn if soon-to-be-removed --megabyte option is used

* src/df.c: MEGABYTES_OPTION: Add new enum and mark it to be removed
in August 2013.
* src/df.c (long_options): Use MEGABYTES_OPTION for --megabytes option.
* src/df.c (main): Add case for MEGABYTES_OPTION and issue a deprecation
warning if the long form is being used. Document the short -m option to
exist only for BSD compatibility.
---
 src/df.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/df.c b/src/df.c
index e99fedf..7e30d57 100644
--- a/src/df.c
+++ b/src/df.c
@@ -167,7 +167,8 @@ static size_t nrows;
 enum
 {
   NO_SYNC_OPTION = CHAR_MAX + 1,
-  SYNC_OPTION
+  SYNC_OPTION,
+  MEGABYTES_OPTION  /* FIXME: remove long opt in Aug 2013 */
 };

 static struct option const long_options[] =
@@ -178,7 +179,7 @@ static struct option const long_options[] =
   {"human-readable", no_argument, NULL, 'h'},
   {"si", no_argument, NULL, 'H'},
   {"local", no_argument, NULL, 'l'},
-  {"megabytes", no_argument, NULL, 'm'}, /* obsolescent */
+  {"megabytes", no_argument, NULL, MEGABYTES_OPTION}, /* obsolescent,  */
   {"portability", no_argument, NULL, 'P'},
   {"print-type", no_argument, NULL, 'T'},
   {"sync", no_argument, NULL, SYNC_OPTION},
@@ -951,7 +952,14 @@ main (int argc, char **argv)
         case 'l':
           show_local_fs = true;
           break;
-        case 'm': /* obsolescent */
+        case MEGABYTES_OPTION:
+          /* Distinguish between the long and the short option.
+             As we want to remove the long option soon,
+             give a warning when the long form is used.  */
+          error (0, 0, "%s%s", _("warning: "),
+            _("long option '--megabytes' is deprecated"
+              " and will soon be removed"));
+        case 'm': /* obsolescent, exists for BSD compatibility */
           human_output_opts = 0;
           output_block_size = 1024 * 1024;
           break;
-- 
1.7.7






reply via email to

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