diff options
author | srs5694 <srs5694@users.sourceforge.net> | 2012-03-25 16:13:16 -0400 |
---|---|---|
committer | srs5694 <srs5694@users.sourceforge.net> | 2012-03-25 16:13:16 -0400 |
commit | a6297b8a2c24adc5aa6dcd03cdc766368cda898d (patch) | |
tree | 7f1dc43989bab06828df05388048f32a51bbdd7e /support.cc | |
parent | 3488294d718a0e8b7f312c80c9e5729671173f6a (diff) | |
download | sgdisk-a6297b8a2c24adc5aa6dcd03cdc766368cda898d.tar.gz |
Fix Ctrl+D problems; 0.8.4 release
Diffstat (limited to 'support.cc')
-rw-r--r-- | support.cc | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -38,8 +38,8 @@ string ReadString(void) { string inString; getline(cin, inString); - if (!cin) - cin.clear(); + if (!cin.good()) + exit(5); return inString; } // ReadString() @@ -56,6 +56,8 @@ int GetNumber(int low, int high, int def, const string & prompt) { do { cout << prompt; cin.getline(line, 255); + if (!cin.good()) + exit(5); num = sscanf(line, "%d", &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) @@ -100,6 +102,8 @@ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, do { cout << prompt; cin.getline(line, 255); + if (!cin.good()) + exit(5); response = IeeeToInt(line, sSize, low, high, def); } while ((response < low) || (response > high)); return response; |