From 35ce145f6adc8ca15555bf976fd69af41879e161 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 18 Sep 2014 11:56:49 +0200 Subject: [PATCH] sfdisk: add deprecated --Linux The sfdisk does not care about compatibility with classic DOS partitioning, and it does not warn about incompatibility with DOS at all. It means that --Linux is default and it's unnecessary to use this option. It's the same situation like with "--unit S", these options are very probably often used in scripts, and these all is default now. So for backward compatibility new sfdisk accepts these options on command line, but prints "option is deprecated" warning message. Signed-off-by: Karel Zak --- Documentation/deprecated.txt | 7 ++++++- disk-utils/sfdisk.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Documentation/deprecated.txt b/Documentation/deprecated.txt index 1757d5cca4..fc31ece5d0 100644 --- a/Documentation/deprecated.txt +++ b/Documentation/deprecated.txt @@ -7,7 +7,12 @@ what: sfdisk --show-size why: this does not belong to fdisk, use "blockdev --getsz" -------------------------- - + +what: sfdisk --Linux +why: unnecessary option, only Linux (non-DOS mode) is supported + +-------------------------- + what: sfdisk --unit why: unnecessary option, only 'S'ector unit is supported diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 32b065d345..dbc1d60f7c 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -916,8 +916,10 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out) fputs(USAGE_OPTIONS, out); fputs(_(" -N, --partno specify partition number\n"), out); fputs(_(" -X, --label specify label type (dos, gpt, ...)\n"), out); - fputs(_(" -u, --unit S deprecated, all input and output is in sectors only\n"), out); fputs(_(" -q, --quiet suppress extra info messages\n"), out); + fputs(USAGE_SEPARATOR, out); + fputs(_(" -u, --unit S deprecated, only sector unit is supported\n"), out); + fputs(_(" -L, --Linux deprecated and ignored, only for backward copatibility\n"), out); fputs(USAGE_SEPARATOR, out); fputs(USAGE_HELP, out); @@ -955,7 +957,9 @@ int main(int argc, char *argv[]) { "quiet", no_argument, NULL, 'q' }, { "verify", no_argument, NULL, 'V' }, { "version", no_argument, NULL, 'v' }, + { "unit", required_argument, NULL, 'u' }, /* deprecated */ + { "Linux", no_argument, NULL, 'L' }, /* deprecated */ { "type",no_argument, NULL, 'c' }, /* wanted */ { "change-id",no_argument, NULL, OPT_CHANGE_ID }, /* deprecated */ @@ -970,7 +974,7 @@ int main(int argc, char *argv[]) textdomain(PACKAGE); atexit(close_stdout); - while ((c = getopt_long(argc, argv, "adhglN:qsTu:vVX:", + while ((c = getopt_long(argc, argv, "adhglLN:qsTu:vVX:", longopts, &longidx)) != -1) { switch(c) { case 'a': @@ -991,6 +995,9 @@ int main(int argc, char *argv[]) case 'l': sf->act = ACT_LIST; break; + case 'L': + warnx(_("--Linux option is deprecated and unnecessary")); + break; case 'd': sf->act = ACT_DUMP; break; -- 2.47.3