Perform case insensitive search of partition types
This commit is contained in:
4
cgdisk.8
4
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
|
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.
|
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
|
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
|
descriptions that include the string \fILinux\fR. This search is performed
|
||||||
case\-sensitively.
|
case\-insensitively.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Verify
|
.B Verify
|
||||||
|
|||||||
4
gdisk.8
4
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
|
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
|
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
|
\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
|
codes with descriptions that include the string \fILinux\fR. This search is
|
||||||
performed case\-sensitively.
|
performed case\-insensitively.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B n
|
.B n
|
||||||
|
|||||||
@@ -510,10 +510,10 @@ void PartType::ShowAllTypes(int maxLines) const {
|
|||||||
cout.unsetf(ios::uppercase);
|
cout.unsetf(ios::uppercase);
|
||||||
if (maxLines > 0) {
|
if (maxLines > 0) {
|
||||||
cout << "Type search string, or <Enter> to show all codes: ";
|
cout << "Type search string, or <Enter> to show all codes: ";
|
||||||
matchString = ReadString();
|
matchString = ToLower(ReadString());
|
||||||
} // if
|
} // if
|
||||||
while (thisType != NULL) {
|
while (thisType != NULL) {
|
||||||
found = thisType->name.find(matchString);
|
found = ToLower(thisType->name).find(matchString);
|
||||||
if ((thisType->display == 1) && (found != string::npos)) { // show it
|
if ((thisType->display == 1) && (found != string::npos)) { // show it
|
||||||
cout.fill('0');
|
cout.fill('0');
|
||||||
cout.width(4);
|
cout.width(4);
|
||||||
|
|||||||
10
support.cc
10
support.cc
@@ -16,6 +16,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cctype>
|
||||||
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
@@ -357,3 +359,11 @@ void WinWarning(void) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
#endif
|
||||||
} // WinWarning()
|
} // 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()
|
||||||
|
|||||||
@@ -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
|
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 ReverseBytes(void* theValue, int numBytes); // Reverses byte-order of theValue
|
||||||
void WinWarning(void);
|
void WinWarning(void);
|
||||||
|
string ToLower(const string& input);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user