diff --git a/cgdisk.8 b/cgdisk.8 index ef982b4..72dcb2a 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -263,9 +263,9 @@ two\-byte hexadecimal number. You may also enter a GUID directly, if you have one and \fBcgdisk\fR doesn't know it. If you don't know the type code for your partition, you can type \fBL\fR to see a list of known type codes. The type code list may optionally be filtered by a search string; for -instance, entering \fI\fBLinux\fR\fR shows only partition type codes with +instance, entering \fI\fBlinux\fR\fR shows only partition type codes with descriptions that include the string \fILinux\fR. This search is performed -case\-sensitively. +case\-insensitively. .TP .B Verify diff --git a/gdisk.8 b/gdisk.8 index fcd07e2..9a968ec 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -191,9 +191,9 @@ more codes in GPT. For these, \fBgdisk\fR adds code numbers sequentially, such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD boot, 0xa502 for FreeBSD swap, and so on. Note that these two\-byte codes are unique to \fBgdisk\fR. The type code list may optionally be filtered by a search -string; for instance, entering \fI\fBLinux\fR\fR shows only partition type +string; for instance, entering \fI\fBlinux\fR\fR shows only partition type codes with descriptions that include the string \fILinux\fR. This search is -performed case\-sensitively. +performed case\-insensitively. .TP .B n diff --git a/parttypes.cc b/parttypes.cc index 38b9193..9508933 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -510,10 +510,10 @@ void PartType::ShowAllTypes(int maxLines) const { cout.unsetf(ios::uppercase); if (maxLines > 0) { cout << "Type search string, or to show all codes: "; - matchString = ReadString(); + matchString = ToLower(ReadString()); } // if while (thisType != NULL) { - found = thisType->name.find(matchString); + found = ToLower(thisType->name).find(matchString); if ((thisType->display == 1) && (found != string::npos)) { // show it cout.fill('0'); cout.width(4); diff --git a/support.cc b/support.cc index d47965a..c80cb2d 100644 --- a/support.cc +++ b/support.cc @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include #include "support.h" @@ -357,3 +359,11 @@ void WinWarning(void) { exit(0); #endif } // WinWarning() + +// Returns the input string in lower case +string ToLower(const string& input) { + string lower = input; // allocate correct size through copy + + transform(input.begin(), input.end(), lower.begin(), ::tolower); + return lower; +} // ToLower() diff --git a/support.h b/support.h index 8f976da..f71c7cb 100644 --- a/support.h +++ b/support.h @@ -82,5 +82,6 @@ int IsHex(string input); // Returns 1 if input can be hexadecimal number.... int IsLittleEndian(void); // Returns 1 if CPU is little-endian, 0 if it's big-endian void ReverseBytes(void* theValue, int numBytes); // Reverses byte-order of theValue void WinWarning(void); +string ToLower(const string& input); #endif