summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-06 15:49:20 (GMT)
committerCaolán McNamara <caolanm@redhat.com>2012-03-06 15:49:48 (GMT)
commit4efbd87e31e7488dfcdd1d07ff979f1f59b8b1f1 (patch)
treebd71bb49bf16c14e310864c0e1c95f74caf443d7
parent5ce699f0c82d5bfd629c22be0747bbe3b851a9fd (diff)
Resolves: rhbz#800272 complain about unknown command-line options
-rw-r--r--desktop/source/app/cmdlineargs.cxx17
-rw-r--r--desktop/source/app/cmdlineargs.hxx2
-rw-r--r--desktop/source/app/officeipcthread.cxx6
-rw-r--r--desktop/source/app/sofficemain.cxx4
4 files changed, 28 insertions, 1 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 6a5d58a..5ae86ab 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 f79efea..29b2f463 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 b2c6566..4306a67 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 76562a3..ed22834 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