From: Matthew Dillon Date: Tue, 11 Aug 2009 17:06:01 +0000 (-0700) Subject: disklabel* - Make disk and filesystem types case insensitive. X-Git-Tag: v2.4.0~281 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a8de4644e441358bbf7213fb1b7a3d04457280fa 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. --- 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 {