[Lldb-commits] [lldb] r114033 - /lldb/trunk/test/settings/main.cpp

Johnny Chen johnny.chen at apple.com
Wed Sep 15 15:48:40 PDT 2010


Author: johnny
Date: Wed Sep 15 17:48:40 2010
New Revision: 114033

URL: http://llvm.org/viewvc/llvm-project?rev=114033&view=rev
Log:
Simplied main() and emits a message to the standard out.

Modified:
    lldb/trunk/test/settings/main.cpp

Modified: lldb/trunk/test/settings/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/main.cpp?rev=114033&r1=114032&r2=114033&view=diff
==============================================================================
--- lldb/trunk/test/settings/main.cpp (original)
+++ lldb/trunk/test/settings/main.cpp Wed Sep 15 17:48:40 2010
@@ -10,26 +10,23 @@
 #include <cstdlib>
 #include <string>
 #include <fstream>
+#include <iostream>
 
 int
 main(int argc, char const *argv[])
 {
-    char const *cptr = NULL;
     // The program writes its output to the "output.txt" file.
     std::ofstream outfile("output.txt");
 
-    for (unsigned i = 0, e = sizeof(argv); i < e; ++i) {
-        if ((cptr = argv[i]) == NULL)
-            break;
-
-        std::string str(cptr);
-        if (i == 1 && "A" == str)
+    for (unsigned i = 0; i < argc; ++i) {
+        std::string theArg(argv[i]);
+        if (i == 1 && "A" == theArg)
             outfile << "argv[1] matches\n";
 
-        if (i == 2 && "B" == str)
+        if (i == 2 && "B" == theArg)
             outfile << "argv[2] matches\n";
 
-        if (i == 3 && "C" == str)
+        if (i == 3 && "C" == theArg)
             outfile << "argv[3] matches\n";
     }
 
@@ -40,5 +37,7 @@
         }
     }
 
+    std::cout << "This message should go to standard out.\n";
+
     return 0;
 }





More information about the lldb-commits mailing list