disklabel* - Make disk and filesystem types case insensitive.
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 11 Aug 2009 17:06:01 +0000 (10:06 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 11 Aug 2009 17:06:01 +0000 (10:06 -0700)
* 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
sbin/disklabel64/disklabel64.c

index 605f0d8..820090e 100644 (file)
@@ -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 {
index 067e03a..5b8ae1e 100644 (file)
@@ -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 {