summaryrefslogtreecommitdiff
path: root/support.cc
diff options
context:
space:
mode:
authorGilles Moris <gilles.moris@free.fr>2019-05-15 07:33:38 +0200
committerGilles Moris <gilles.moris@free.fr>2019-05-15 07:33:38 +0200
commitf9d08a6b6bf0bae229f45eeebeeacc64d4369151 (patch)
treeebecf4d6799394c59283f7930594b11083acb53c /support.cc
parent522273e3db5823aedf6af8786cb01a316367ed32 (diff)
downloadsgdisk-f9d08a6b6bf0bae229f45eeebeeacc64d4369151.tar.gz
Perform case insensitive search of partition types
Diffstat (limited to 'support.cc')
-rw-r--r--support.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/support.cc b/support.cc
index d47965a..c80cb2d 100644
--- a/support.cc
+++ b/support.cc
@@ -16,6 +16,8 @@
#include <string.h>
#include <sys/stat.h>
#include <string>
+#include <cctype>
+#include <algorithm>
#include <iostream>
#include <sstream>
#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()