Kaydet (Commit) 4efbd87e authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: rhbz#800272 complain about unknown command-line options

üst 5ce699f0
...@@ -304,6 +304,15 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) ...@@ -304,6 +304,15 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{ {
bConversionOutEvent = true; 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 else
{ {
...@@ -640,7 +649,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& ...@@ -640,7 +649,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
if (bDeprecated) 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()); fprintf(stderr, "Warning: %s is deprecated. Use -%s instead.\n", sArg.getStr(), sArg.getStr());
} }
return sal_True; return sal_True;
...@@ -851,6 +860,12 @@ sal_Bool CommandLineArgs::IsVersion() const ...@@ -851,6 +860,12 @@ sal_Bool CommandLineArgs::IsVersion() const
return m_aBoolParams[ CMD_BOOLPARAM_VERSION ]; 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 sal_Bool CommandLineArgs::HasModuleParam() const
{ {
osl::MutexGuard aMutexGuard( m_aMutex ); osl::MutexGuard aMutexGuard( m_aMutex );
......
...@@ -71,6 +71,7 @@ class CommandLineArgs ...@@ -71,6 +71,7 @@ class CommandLineArgs
CMD_BOOLPARAM_HELPBASE, CMD_BOOLPARAM_HELPBASE,
CMD_BOOLPARAM_PSN, CMD_BOOLPARAM_PSN,
CMD_BOOLPARAM_VERSION, CMD_BOOLPARAM_VERSION,
CMD_BOOLPARAM_UNKNOWN,
CMD_BOOLPARAM_COUNT // must be last element! CMD_BOOLPARAM_COUNT // must be last element!
}; };
...@@ -162,6 +163,7 @@ class CommandLineArgs ...@@ -162,6 +163,7 @@ class CommandLineArgs
sal_Bool IsWeb() const; sal_Bool IsWeb() const;
sal_Bool IsVersion() const; sal_Bool IsVersion() const;
sal_Bool HasModuleParam() const; sal_Bool HasModuleParam() const;
sal_Bool HasUnknown() const;
sal_Bool WantsToLoadDocument() const; sal_Bool WantsToLoadDocument() const;
// Access to string parameters // Access to string parameters
......
...@@ -709,6 +709,12 @@ void OfficeIPCThread::execute() ...@@ -709,6 +709,12 @@ void OfficeIPCThread::execute()
#endif #endif
continue; continue;
} }
#ifdef UNX
if (aCmdLineArgs->HasUnknown() || aCmdLineArgs->IsVersion() || aCmdLineArgs->IsHelp())
continue;
#endif
const CommandLineArgs &rCurrentCmdLineArgs = Desktop::GetCommandLineArgs(); const CommandLineArgs &rCurrentCmdLineArgs = Desktop::GetCommandLineArgs();
if ( aCmdLineArgs->IsQuickstart() ) if ( aCmdLineArgs->IsQuickstart() )
......
...@@ -71,6 +71,10 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() ...@@ -71,6 +71,10 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
desktop::displayVersion(); desktop::displayVersion();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if ( rCmdLineArgs.HasUnknown() )
{
return EXIT_FAILURE;
}
#endif #endif
return SVMain(); return SVMain();
#ifdef ANDROID #ifdef ANDROID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment