summaryrefslogtreecommitdiff
path: root/src/df.c
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2012-07-11 17:27:20 +0200
committerJim Meyering <meyering@redhat.com>2012-07-11 20:30:21 +0200
commit453ce92f6fadaacd08a8e88c6a239129bd3397e3 (patch)
treeeb7da1de6f64fce2fa4bc841b96d3d6c065811b2 /src/df.c
parentc2f590dc9a08dabcd18411bd4a4b85a0a82c2c08 (diff)
downloadcoreutils-453ce92f6fadaacd08a8e88c6a239129bd3397e3.tar.xz
df: warn if soon-to-be-removed --megabyte option is used
* src/df.c (MEGABYTES_OPTION): Add enum and mark it for removal in August 2013. (long_options): Use MEGABYTES_OPTION for --megabytes option. (main): Add a case for it and issue a deprecation warning if the long form is used. Document the short -m option to exist only for BSD compatibility.
Diffstat (limited to 'src/df.c')
-rw-r--r--src/df.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/df.c b/src/df.c
index e99fedff4..7e30d57f7 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;