This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 1/9] Allow options which only have long names


We're kind of running out of letters for short options :)
---
 libgetopt++/include/getopt++/DefaultFormatter.h | 7 +++++--
 main.cc                                         | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libgetopt++/include/getopt++/DefaultFormatter.h b/libgetopt++/include/getopt++/DefaultFormatter.h
index 38287f1..440eb54 100644
--- a/libgetopt++/include/getopt++/DefaultFormatter.h
+++ b/libgetopt++/include/getopt++/DefaultFormatter.h
@@ -45,8 +45,11 @@ class DefaultFormatter {
         theStream(aStream)
     {}
     void operator () (Option *anOption) {
-      theStream << s_lead << anOption->shortOption ()[0]
-		<< l_lead << anOption->longOption ()
+      if (anOption->shortOption ()[0] == '\0')
+        theStream << "   ";
+      else
+        theStream << s_lead << anOption->shortOption ()[0];
+      theStream << l_lead << anOption->longOption ()
 		<< std::string (o_len
 				- s_lead.size () - 1 - l_lead.size ()
 				- anOption->longOption ().size (), ' ');
diff --git a/main.cc b/main.cc
index fe1d6c1..b44f9b6 100644
--- a/main.cc
+++ b/main.cc
@@ -94,7 +94,7 @@ static BoolOption NoAdminOption (false, 'B', "no-admin", "Do not check for and e
 static BoolOption WaitOption (false, 'W', "wait", "When elevating, wait for elevated child process");
 static BoolOption HelpOption (false, 'h', "help", "print help");
 static StringOption SetupBaseNameOpt ("setup", 'i', "ini-basename", "Use a different basename, e.g. \"foo\", instead of \"setup\"", false);
-BoolOption UnsupportedOption (false, '0', "allow-unsupported-windows", "Allow old, unsupported Windows versions");
+BoolOption UnsupportedOption (false, '\0', "allow-unsupported-windows", "Allow old, unsupported Windows versions");
 std::string SetupBaseName;
 
 static void inline
-- 
2.12.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]