diff options
author | des <des@FreeBSD.org> | 2004-08-08 23:14:44 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-08-08 23:14:44 +0000 |
commit | 9c026741d82b7c5b820c5d71f95c634b458a5bb0 (patch) | |
tree | 3b5503b88178565fab4e8e97db5e39f459e17b4f | |
parent | 8cec0bf03fd177fa80c4d1d74e435fad9a150909 (diff) | |
download | FreeBSD-src-9c026741d82b7c5b820c5d71f95c634b458a5bb0.zip FreeBSD-src-9c026741d82b7c5b820c5d71f95c634b458a5bb0.tar.gz |
Use fallthrough to simplify the multiplier logic; optimistically add
support for the T multiplier; improve the error message for unrecognized
multipliers.
-rw-r--r-- | sbin/bsdlabel/bsdlabel.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 9012282..d1d5f02 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 */ |