Fixed bug that caused input glitches (trailing line feeds and

difficulty entering type codes) on EFI version.
This commit is contained in:
Roderick W. Smith
2015-10-18 13:43:03 -04:00
parent bdae070734
commit 080ff55bc2
2 changed files with 11 additions and 2 deletions

View File

@@ -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