diff options
author | Roderick W. Smith <rodsmith@rodsbooks.com> | 2015-10-18 13:43:03 -0400 |
---|---|---|
committer | Roderick W. Smith <rodsmith@rodsbooks.com> | 2015-10-18 13:43:03 -0400 |
commit | 080ff55bc2d1b4d928b30159812033c31ae27ae5 (patch) | |
tree | 9a9f967497eef376f9cec1251b37eb8213fee232 /support.cc | |
parent | bdae07073456eeddbedb99c8a2c1f9ec7862a9c5 (diff) | |
download | sgdisk-080ff55bc2d1b4d928b30159812033c31ae27ae5.tar.gz |
Fixed bug that caused input glitches (trailing line feeds and
difficulty entering type codes) on EFI version.
Diffstat (limited to 'support.cc')
-rw-r--r-- | support.cc | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -39,9 +39,16 @@ extern int __sscanf( const char * str , const char * format , ... ) ; string ReadString(void) { string inString; char efiString[256]; + int stringLength; - fgets(efiString, 255, stdin); - inString = efiString; + if (fgets(efiString, 255, stdin) != NULL) { + stringLength = strlen(efiString); + if ((stringLength > 0) && (efiString[stringLength - 1] == '\n')) + efiString[stringLength - 1] = '\0'; + inString = efiString; + } else { + inString = ""; + } return inString; } // ReadString() #else |