aboutsummaryrefslogtreecommitdiff
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2004-08-08 23:14:44 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2004-08-08 23:14:44 +0000
commit4c814dfc279de3af3c31701f065722075807c4d3 (patch)
tree3b5503b88178565fab4e8e97db5e39f459e17b4f /sbin/bsdlabel/bsdlabel.c
parent266e79978a7b4a3acdf2cdfa64a8a8e32544ac87 (diff)
downloadsrc-4c814dfc279de3af3c31701f065722075807c4d3.tar.gz
src-4c814dfc279de3af3c31701f065722075807c4d3.zip
Use fallthrough to simplify the multiplier logic; optimistically add
support for the T multiplier; improve the error message for unrecognized multipliers.
Notes
Notes: svn path=/head/; revision=133348
Diffstat (limited to 'sbin/bsdlabel/bsdlabel.c')
-rw-r--r--sbin/bsdlabel/bsdlabel.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index 901228213e4d..d1d5f02fd2a0 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -1152,22 +1152,27 @@ checklabel(struct disklabel *lp)
case '%':
total_percent += size;
break;
- case 'k':
- case 'K':
+ case 't':
+ case 'T':
size *= 1024ULL;
- break;
- case 'm':
- case 'M':
- size *= 1024ULL * 1024ULL;
- break;
+ /* FALLTHROUGH */
case 'g':
case 'G':
- size *= 1024ULL * 1024ULL * 1024ULL;
+ size *= 1024ULL;
+ /* FALLTHROUGH */
+ case 'm':
+ case 'M':
+ size *= 1024ULL;
+ /* FALLTHROUGH */
+ case 'k':
+ case 'K':
+ size *= 1024ULL;
break;
case '\0':
break;
default:
- warnx("unknown size specifier '%c' (K/M/G are valid)",part_size_type[i]);
+ warnx("unknown multiplier prefix '%c' for partition %c (should be K, M, G or T)",
+ part_size_type[i], i + 'a');
break;
}
/* don't count %'s yet */