diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-06 15:49:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-06 15:49:48 +0000 |
commit | 4efbd87e31e7488dfcdd1d07ff979f1f59b8b1f1 (patch) | |
tree | bd71bb49bf16c14e310864c0e1c95f74caf443d7 /desktop | |
parent | 5ce699f0c82d5bfd629c22be0747bbe3b851a9fd (diff) |
Resolves: rhbz#800272 complain about unknown command-line options
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 17 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.hxx | 2 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 6 | ||||
-rw-r--r-- | desktop/source/app/sofficemain.cxx | 4 |
4 files changed, 28 insertions, 1 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 6a5d58a7a95c..5ae86ab20480 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -304,6 +304,15 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) { bConversionOutEvent = true; } +#if defined UNX + else + { + printf("Unknown option %s\n", + rtl::OUStringToOString(aArg, osl_getThreadTextEncoding()).getStr()); + printf("Run 'soffice --help' to see a full list of available command line options.\n"); + SetBoolParam_Impl( CMD_BOOLPARAM_UNKNOWN, sal_True ); + } +#endif } else { @@ -640,7 +649,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& if (bDeprecated) { - rtl::OString sArg(rtl::OUStringToOString(aArg, RTL_TEXTENCODING_UTF8)); + rtl::OString sArg(rtl::OUStringToOString(aArg, osl_getThreadTextEncoding())); fprintf(stderr, "Warning: %s is deprecated. Use -%s instead.\n", sArg.getStr(), sArg.getStr()); } return sal_True; @@ -851,6 +860,12 @@ sal_Bool CommandLineArgs::IsVersion() const return m_aBoolParams[ CMD_BOOLPARAM_VERSION ]; } +sal_Bool CommandLineArgs::HasUnknown() const +{ + osl::MutexGuard aMutexGuard( m_aMutex ); + return m_aBoolParams[ CMD_BOOLPARAM_UNKNOWN ]; +} + sal_Bool CommandLineArgs::HasModuleParam() const { osl::MutexGuard aMutexGuard( m_aMutex ); diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index f79efeaab6e7..29b2f463e55f 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -71,6 +71,7 @@ class CommandLineArgs CMD_BOOLPARAM_HELPBASE, CMD_BOOLPARAM_PSN, CMD_BOOLPARAM_VERSION, + CMD_BOOLPARAM_UNKNOWN, CMD_BOOLPARAM_COUNT // must be last element! }; @@ -162,6 +163,7 @@ class CommandLineArgs sal_Bool IsWeb() const; sal_Bool IsVersion() const; sal_Bool HasModuleParam() const; + sal_Bool HasUnknown() const; sal_Bool WantsToLoadDocument() const; // Access to string parameters diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index b2c65669c058..4306a67e58ac 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -709,6 +709,12 @@ void OfficeIPCThread::execute() #endif continue; } + +#ifdef UNX + if (aCmdLineArgs->HasUnknown() || aCmdLineArgs->IsVersion() || aCmdLineArgs->IsHelp()) + continue; +#endif + const CommandLineArgs &rCurrentCmdLineArgs = Desktop::GetCommandLineArgs(); if ( aCmdLineArgs->IsQuickstart() ) diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 76562a32e630..ed22834ab75d 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -71,6 +71,10 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() desktop::displayVersion(); return EXIT_SUCCESS; } + else if ( rCmdLineArgs.HasUnknown() ) + { + return EXIT_FAILURE; + } #endif return SVMain(); #ifdef ANDROID |