This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 1/9] Allow options which only have long names
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: cygwin-apps at cygwin dot com
- Cc: Jon Turney <jon dot turney at dronecode dot org dot uk>
- Date: Tue, 6 Jun 2017 12:54:24 +0100
- Subject: [PATCH setup 1/9] Allow options which only have long names
- Authentication-results: sourceware.org; auth=none
- References: <20170606115432.105020-1-jon.turney@dronecode.org.uk>
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