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.7 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. @@ -418,7 +418,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. @@ -816,7 +816,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. @@ -524,7 +524,7 @@ void PartType::ShowAllTypes(int maxLines) const {
  53. if (thisType->next) {
  54. cout << "\n";
  55. if ((maxLines > 0) && (lineCount++ % maxLines) == 0) {
  56. - cout << "Press the <Enter> key to see more codes: ";
  57. + cout << "Press the <Enter> key to see more codes: " << flush;
  58. getline(cin, line);
  59. } // if reached screen line limit
  60. } // if there's another entry following this one
  61. diff --git a/support.cc b/support.cc
  62. index 891caad..645ef5d 100644
  63. --- a/support.cc
  64. +++ b/support.cc
  65. @@ -123,7 +123,7 @@ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize,
  66. char line[255];
  67. do {
  68. - cout << prompt;
  69. + cout << prompt << flush;
  70. cin.getline(line, 255);
  71. if (!cin.good())
  72. exit(5);
  73. --
  74. 2.17.1