sfdisk: disambiguate units of --show-size

[kzak@redhat.com: - use optutils.h]

Signed-off-by: Chris Morin <chris.morin2@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Chris Morin 2017-05-18 20:07:19 -04:00 committed by Karel Zak
parent 36b608417b
commit b0ff9a76b7
2 changed files with 17 additions and 4 deletions

View File

@ -132,7 +132,9 @@ then print the current partition UUID.
Renumber the partitions, ordering them by their start offset.
.TP
.BR \-s , " \-\-show\-size " [ \fIdevice ...]
List the sizes of all or the specified devices.
List the sizes of all or the specified devices in units of 1024 byte size.
This command is DEPRECATED in favour of
.BR blockdev (1).
.TP
.BR \-T , " \-\-list\-types"
Print all supported types for the current disk label or the label specified by
@ -219,7 +221,8 @@ specified in the format \fI+list\fP (e.g. \fB-o +UUID\fP).
Suppress extra info messages.
.TP
.BR \-u , " \-\-unit S"
Deprecated option. Only the sector unit is supported.
Deprecated option. Only the sector unit is supported. This option is not
supported when using the --show-size command.
.TP
.BR \-X , " \-\-label " \fItype
Specify the disk label type (e.g. \fBdos\fR, \fBgpt\fR, ...). If this option

View File

@ -49,6 +49,7 @@
#include "all-io.h"
#include "rpmatch.h"
#include "loopdev.h"
#include "optutils.h"
#include "libfdisk.h"
#include "fdisk-list.h"
@ -1961,7 +1962,6 @@ int main(int argc, char *argv[])
{ "output", required_argument, NULL, 'o' },
{ "partno", required_argument, NULL, 'N' },
{ "reorder", no_argument, NULL, 'r' },
{ "show-size", no_argument, NULL, 's' },
{ "show-geometry", no_argument, NULL, 'g' },
{ "quiet", no_argument, NULL, 'q' },
{ "verify", no_argument, NULL, 'V' },
@ -1975,8 +1975,9 @@ int main(int argc, char *argv[])
{ "part-attrs", no_argument, NULL, OPT_PARTATTRS },
{ "show-pt-geometry", no_argument, NULL, 'G' }, /* deprecated */
{ "unit", required_argument, NULL, 'u' },
{ "unit", required_argument, NULL, 'u' }, /* deprecated */
{ "Linux", no_argument, NULL, 'L' }, /* deprecated */
{ "show-size", no_argument, NULL, 's' }, /* deprecated */
{ "change-id",no_argument, NULL, OPT_CHANGE_ID }, /* deprecated */
{ "id", no_argument, NULL, 'c' }, /* deprecated */
@ -1984,6 +1985,12 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0 },
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
{ 's','u'}, /* --show-size --unit */
{ 0 }
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@ -1992,6 +1999,9 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "aAbcdfFgGhJlLo:O:nN:qrsTu:vVX:Y:w:W:",
longopts, &longidx)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
switch(c) {
case 'A':
sf->act = ACT_ACTIVATE;