You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.6 KiB

  1. From b33f93bea332211afae037e4b6f379f0876302d1 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Tue, 8 Oct 2019 20:51:54 -0700
  4. Subject: [PATCH] Add some extra flushes before getline/cin
  5. These are not covered by the previous commits.
  6. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  7. ---
  8. diskio-unix.cc | 2 +-
  9. gptcurses.cc | 4 ++--
  10. parttypes.cc | 2 +-
  11. support.cc | 2 +-
  12. 4 files changed, 5 insertions(+), 5 deletions(-)
  13. diff --git a/diskio-unix.cc b/diskio-unix.cc
  14. index d9f8b8d..c38fda5 100644
  15. --- a/diskio-unix.cc
  16. +++ b/diskio-unix.cc
  17. @@ -92,7 +92,7 @@ int DiskIO::OpenForRead(void) {
  18. #if defined(__linux__) && !defined(EFI)
  19. if (isOpen && realFilename.substr(0,4) == "/dev") {
  20. ostringstream modelNameFilename;
  21. - modelNameFilename << "/sys/block" << realFilename.substr(4,512) << "/device/model";
  22. + modelNameFilename << "/sys/block" << realFilename.substr(4,512) << "/device/model" << flush;
  23. ifstream modelNameFile(modelNameFilename.str().c_str());
  24. if (modelNameFile.is_open()) {
  25. getline(modelNameFile, modelName);
  26. diff --git a/gptcurses.cc b/gptcurses.cc
  27. index 4ebfde1..ca6f4ea 100644
  28. --- a/gptcurses.cc
  29. +++ b/gptcurses.cc
  30. @@ -422,7 +422,7 @@ void GPTDataCurses::Verify(void) {
  31. def_prog_mode();
  32. endwin();
  33. GPTData::Verify();
  34. - cout << "\nPress the <Enter> key to continue: ";
  35. + cout << "\nPress the <Enter> key to continue: " << flush;
  36. cin.get(junk);
  37. reset_prog_mode();
  38. refresh();
  39. @@ -820,7 +820,7 @@ void ShowTypes(void) {
  40. def_prog_mode();
  41. endwin();
  42. tempType.ShowAllTypes(LINES - 3);
  43. - cout << "\nPress the <Enter> key to continue: ";
  44. + cout << "\nPress the <Enter> key to continue: " << flush;
  45. cin.get(junk);
  46. reset_prog_mode();
  47. refresh();
  48. diff --git a/parttypes.cc b/parttypes.cc
  49. index cd225d1..6c2c8c6 100644
  50. --- a/parttypes.cc
  51. +++ b/parttypes.cc
  52. @@ -530,7 +530,7 @@ void PartType::ShowAllTypes(int maxLines) const {
  53. cout.unsetf(ios::uppercase);
  54. if (maxLines > 0) {
  55. - cout << "Type search string, or <Enter> to show all codes: ";
  56. + cout << "Type search string, or <Enter> to show all codes: " << flush;
  57. matchString = ToLower(ReadString());
  58. } // if
  59. while (thisType != NULL) {
  60. diff --git a/support.cc b/support.cc
  61. index 891caad..645ef5d 100644
  62. --- a/support.cc
  63. +++ b/support.cc
  64. @@ -127,7 +127,7 @@ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize,
  65. char line[255];
  66. do {
  67. - cout << prompt;
  68. + cout << prompt << flush;
  69. cin.getline(line, 255);
  70. if (!cin.good())
  71. exit(5);
  72. --
  73. 2.17.1