From f4a4ba9ac1b58b4726825400e1edd1bf47d4080a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 25 Sep 2012 10:15:15 +0200 Subject: Clean up option processing * Support --version on non-UNX, too. * Consistently show the first unknown option and the help blob in the presence of any unknown options. * There is no need to tunnel --help/--version past oosplash in the soffice script, as oosplash is prepared to treat them adequately (esp. not pass them over any pipe); this only added unnecessary variance to what spellings exactly are supported and how mixtures of --help, --version, and unknown options are handled. Change-Id: I617f2e727e2f0eafd34a2de3b85d441c6783ec4f --- desktop/source/app/cmdlineargs.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'desktop/source/app/cmdlineargs.cxx') diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 83b728fd4ff6..01e1f30eae62 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -287,26 +287,25 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) { bConversionOutEvent = true; } -#if defined UNX else // because it's impossible to filter these options that // are handled in the soffice shell script with the // primitive tools that /bin/sh offers, ignore them here - if (!oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("backtrace")) && + if ( +#if defined UNX + !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("backtrace")) && !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("strace")) && !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("valgrind")) && // for X Session Management, handled in // vcl/unx/generic/app/sm.cxx: !oArg.match("session=") && +#endif //ignore additional legacy options that don't do anything anymore - !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("nocrashreport"))) + !oArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("nocrashreport")) && + m_unknown.isEmpty()) { - fprintf(stderr, "Unknown option %s\n", - rtl::OUStringToOString(aArg, osl_getThreadTextEncoding()).getStr()); - fprintf(stderr, "Run 'soffice --help' to see a full list of available command line options.\n"); - m_unknown = true; + m_unknown = aArg; } -#endif } else { @@ -624,7 +623,6 @@ void CommandLineArgs::InitParamValues() m_helpbase = false; m_psn = false; m_version = false; - m_unknown = false; m_splashpipe = false; m_bEmpty = true; m_bDocumentArgs = false; @@ -762,7 +760,7 @@ bool CommandLineArgs::IsVersion() const return m_version; } -bool CommandLineArgs::HasUnknown() const +OUString CommandLineArgs::GetUnknown() const { return m_unknown; } -- cgit