diff options
author | Roderick W. Smith <allura@localhost> | 2020-02-15 21:10:03 +0000 |
---|---|---|
committer | Roderick W. Smith <allura@localhost> | 2020-02-15 21:10:03 +0000 |
commit | 01725eae7d3cf20b54fddfa7d84ec05645be4cf0 (patch) | |
tree | ca98e7bab63373c68a463f5720150869ff35b862 /support.cc | |
parent | bbd6b4cc67ffcdf7b2a6bd5008d28006cb147393 (diff) | |
parent | 6a2b5acdcf9511bf3b50508910b718e369a028f1 (diff) | |
download | sgdisk-01725eae7d3cf20b54fddfa7d84ec05645be4cf0.tar.gz |
Merge /u/morisgi/gptfdisk/ branch enhancements into master
https://sourceforge.net/p/gptfdisk/code/merge-requests/15/
Diffstat (limited to 'support.cc')
-rw-r--r-- | support.cc | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -8,7 +8,9 @@ #define __STDC_LIMIT_MACROS #define __STDC_CONSTANT_MACROS +#define __STDC_FORMAT_MACROS +#include <inttypes.h> #include <stdio.h> #include <stdint.h> #include <errno.h> @@ -16,6 +18,8 @@ #include <string.h> #include <sys/stat.h> #include <string> +#include <cctype> +#include <algorithm> #include <iostream> #include <sstream> #include "support.h" @@ -78,7 +82,7 @@ uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & pro cin.getline(line, 255); if (!cin.good()) exit(5); - num = sscanf(line, "%lld", &response); + num = sscanf(line, "%" PRIu64, &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) cout << "Value out of range\n"; @@ -358,3 +362,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() |