<rdar://problem/13457391>

LLDB now can use a single dash for all long options for all commands form the command line and from the command interpreter. This involved just switching all calls from getopt_long() to getopt_long_only().

llvm-svn: 178789
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp
index c3f32c3..23d10be 100644
--- a/lldb/source/Interpreter/Args.cpp
+++ b/lldb/source/Interpreter/Args.cpp
@@ -655,11 +655,11 @@
     while (1)
     {
         int long_options_index = -1;
-        val = ::getopt_long(GetArgumentCount(),
-                            GetArgumentVector(),
-                            sstr.GetData(),
-                            long_options,
-                            &long_options_index);
+        val = ::getopt_long_only(GetArgumentCount(),
+                                 GetArgumentVector(),
+                                 sstr.GetData(),
+                                 long_options,
+                                 &long_options_index);
         if (val == -1)
             break;
 
@@ -1314,8 +1314,11 @@
     while (1)
     {
         int long_options_index = -1;
-        val = ::getopt_long (GetArgumentCount(), GetArgumentVector(), sstr.GetData(), long_options,
-                             &long_options_index);
+        val = ::getopt_long_only (GetArgumentCount(),
+                                  GetArgumentVector(),
+                                  sstr.GetData(),
+                                  long_options,
+                                  &long_options_index);
 
         if (val == -1)
             break;
@@ -1492,8 +1495,8 @@
     int val;
     const OptionDefinition *opt_defs = options.GetDefinitions();
 
-    // Fooey... getopt_long permutes the GetArgumentVector to move the options to the front.
-    // So we have to build another Arg and pass that to getopt_long so it doesn't
+    // Fooey... getopt_long_only permutes the GetArgumentVector to move the options to the front.
+    // So we have to build another Arg and pass that to getopt_long_only so it doesn't
     // change the one we have.
 
     std::vector<const char *> dummy_vec (GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1);
@@ -1507,11 +1510,11 @@
         int parse_start = optind;
         int long_options_index = -1;
         
-        val = ::getopt_long (dummy_vec.size() - 1,
-                             (char *const *) &dummy_vec.front(), 
-                             sstr.GetData(), 
-                             long_options,
-                             &long_options_index);
+        val = ::getopt_long_only (dummy_vec.size() - 1,
+                                  (char *const *) &dummy_vec.front(),
+                                  sstr.GetData(),
+                                  long_options,
+                                  &long_options_index);
 
         if (val == -1)
         {
@@ -1525,7 +1528,7 @@
             // Handling the "--" is a little tricky, since that may mean end of options or arguments, or the
             // user might want to complete options by long name.  I make this work by checking whether the
             // cursor is in the "--" argument, and if so I assume we're completing the long option, otherwise
-            // I let it pass to getopt_long which will terminate the option parsing.
+            // I let it pass to getopt_long_only which will terminate the option parsing.
             // Note, in either case we continue parsing the line so we can figure out what other options
             // were passed.  This will be useful when we come to restricting completions based on what other
             // options we've seen on the line.
@@ -1641,7 +1644,7 @@
     }
     
     // Finally we have to handle the case where the cursor index points at a single "-".  We want to mark that in
-    // the option_element_vector, but only if it is not after the "--".  But it turns out that getopt_long just ignores
+    // the option_element_vector, but only if it is not after the "--".  But it turns out that getopt_long_only just ignores
     // an isolated "-".  So we have to look it up by hand here.  We only care if it is AT the cursor position.
     
     if ((dash_dash_pos == -1 || cursor_index < dash_dash_pos)
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index 96e0ef9..d2b2ce5 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -169,7 +169,7 @@
         Error error;
         options->NotifyOptionParsingStarting();
 
-        // ParseOptions calls getopt_long, which always skips the zero'th item in the array and starts at position 1,
+        // ParseOptions calls getopt_long_only, which always skips the zero'th item in the array and starts at position 1,
         // so we need to push a dummy value into position zero.
         args.Unshift("dummy_string");
         error = args.ParseOptions (*options);
@@ -416,7 +416,7 @@
 
 
             // I stick an element on the end of the input, because if the last element is
-            // option that requires an argument, getopt_long will freak out.
+            // option that requires an argument, getopt_long_only will freak out.
 
             input.AppendArgument ("<FAKE-VALUE>");
 
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 95b7078..6b509d4 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -310,7 +310,7 @@
             }
         }
 
-        //getopt_long requires a NULL final entry in the table:
+        //getopt_long_only requires a NULL final entry in the table:
 
         m_getopt_table[i].name    = NULL;
         m_getopt_table[i].has_arg = 0;
@@ -796,7 +796,7 @@
             }
             else if (opt_defs_index != OptionArgElement::eUnrecognizedArg)
             {
-                // We recognized it, if it an incomplete long option, complete it anyway (getopt_long is
+                // We recognized it, if it an incomplete long option, complete it anyway (getopt_long_only is
                 // happy with shortest unique string, but it's still a nice thing to do.)  Otherwise return
                 // The string so the upper level code will know this is a full match and add the " ".
                 if (cur_opt_str && strlen (cur_opt_str) > 2
@@ -819,7 +819,7 @@
                 // FIXME - not handling wrong options yet:
                 // Check to see if they are writing a long option & complete it.
                 // I think we will only get in here if the long option table has two elements
-                // that are not unique up to this point.  getopt_long does shortest unique match
+                // that are not unique up to this point.  getopt_long_only does shortest unique match
                 // for long options already.
 
                 if (cur_opt_str && strlen (cur_opt_str) > 2