From a8de4644e441358bbf7213fb1b7a3d04457280fa Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 11 Aug 2009 10:06:01 -0700 Subject: [PATCH] disklabel* - Make disk and filesystem types case insensitive. * e.g. allow 'hammer' or 'HAMMER' to be specified when configuring a filesystem type for a partition. When displayed the proper case will be used. This reduces confusion for people trying to partition a disk manually. --- sbin/disklabel/disklabel.c | 7 ++++--- sbin/disklabel64/disklabel64.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 605f0d8..820090e 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -895,7 +895,7 @@ getasciilabel(FILE *f, struct disklabel32 *lp) tp = unknown; cpp = dktypenames; for (; cpp < &dktypenames[DKMAXTYPES]; cpp++) { - if (*cpp && streq(*cpp, tp)) { + if (*cpp && strcasecmp(*cpp, tp) == 0) { lp->d_type = cpp - dktypenames; break; } @@ -1173,9 +1173,10 @@ getasciipartspec(char *tp, struct disklabel32 *lp, int part, int lineno) } cp = tp; tp = word(cp); - for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++) - if (*cpp && streq(*cpp, cp)) + for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++) { + if (*cpp && strcasecmp(*cpp, cp) == 0) break; + } if (*cpp != NULL) { pp->p_fstype = cpp - fstypenames; } else { diff --git a/sbin/disklabel64/disklabel64.c b/sbin/disklabel64/disklabel64.c index 067e03a..5b8ae1e 100644 --- a/sbin/disklabel64/disklabel64.c +++ b/sbin/disklabel64/disklabel64.c @@ -1169,9 +1169,10 @@ getasciipartspec(char *tp, struct disklabel64 *lp, int part, */ cp = tp; tp = word(cp); - for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++) - if (*cpp && streq(*cpp, cp)) + for (cpp = fstypenames; cpp < &fstypenames[FSMAXTYPES]; cpp++) { + if (*cpp && strcasecmp(*cpp, cp) == 0) break; + } if (*cpp != NULL) { pp->p_fstype = cpp - fstypenames; } else { -- 1.7.7.2