[llvm-branch-commits] [lldb] r199406 - Fixed the CommandInterpreter::Confirm() to work correctly again after IOHandler changes.

Greg Clayton gclayton at apple.com
Thu Jan 16 10:11:34 PST 2014


Author: gclayton
Date: Thu Jan 16 12:11:33 2014
New Revision: 199406

URL: http://llvm.org/viewvc/llvm-project?rev=199406&view=rev
Log:
Fixed the CommandInterpreter::Confirm() to work correctly again after IOHandler changes.


Modified:
    lldb/branches/iohandler/source/Core/IOHandler.cpp

Modified: lldb/branches/iohandler/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/IOHandler.cpp?rev=199406&r1=199405&r2=199406&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/IOHandler.cpp (original)
+++ lldb/branches/iohandler/source/Core/IOHandler.cpp Thu Jan 16 12:11:33 2014
@@ -191,10 +191,43 @@ IOHandlerConfirm::IOHandlerComplete (IOH
 void
 IOHandlerConfirm::IOHandlerInputComplete (IOHandler &io_handler, std::string &line)
 {
-    if (line == "y" || line == "Y" || line == "yes" || line == "YES" || line == "Yes")
+    if (line.empty())
+    {
+        // User just hit enter, set the response to the default
+        m_user_response = m_default_response;
         io_handler.SetIsDone(true);
-    if (line == "n" || line == "N" || line == "no" || line == "NO" || line == "No")
+        return;
+    }
+
+    if (line.size() == 1)
+    {
+        switch (line[0])
+        {
+            case 'y':
+            case 'Y':
+                m_user_response = true;
+                io_handler.SetIsDone(true);
+                return;
+            case 'n':
+            case 'N':
+                m_user_response = false;
+                io_handler.SetIsDone(true);
+                return;
+            default:
+                break;
+        }
+    }
+
+    if (line == "yes" || line == "YES" || line == "Yes")
+    {
+        m_user_response = true;
+        io_handler.SetIsDone(true);
+    }
+    else if (line == "no" || line == "NO" || line == "No")
+    {
+        m_user_response = false;
         io_handler.SetIsDone(true);
+    }
 }
 
 int





More information about the llvm-branch-commits mailing list