[libreoffice/f16] Resolves: rhbz#800272 complain about unknown commandline options

Caolán McNamara caolanm at fedoraproject.org
Tue Mar 6 15:57:16 UTC 2012


commit 577c87ab257a89b05f460ab770a8b9808c3991d4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 6 15:57:12 2012 +0000

    Resolves: rhbz#800272 complain about unknown commandline options

 ...bz-800272-complain-about-unknown-command-.patch |  110 ++++++++++++++++++++
 libreoffice.spec                                   |    3 +
 2 files changed, 113 insertions(+), 0 deletions(-)
---
diff --git a/0001-Resolves-rhbz-800272-complain-about-unknown-command-.patch b/0001-Resolves-rhbz-800272-complain-about-unknown-command-.patch
new file mode 100644
index 0000000..bff16d0
--- /dev/null
+++ b/0001-Resolves-rhbz-800272-complain-about-unknown-command-.patch
@@ -0,0 +1,110 @@
+From 4efbd87e31e7488dfcdd1d07ff979f1f59b8b1f1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Tue, 6 Mar 2012 15:49:20 +0000
+Subject: [PATCH] Resolves: rhbz#800272 complain about unknown command-line
+ options
+
+---
+ desktop/source/app/cmdlineargs.cxx     |   17 ++++++++++++++++-
+ desktop/source/app/cmdlineargs.hxx     |    2 ++
+ desktop/source/app/officeipcthread.cxx |    6 ++++++
+ 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 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..29b2f46 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
+-- 
+1.7.7.6
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 6f7cd79..9b153cf 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -239,6 +239,7 @@ Patch117: 0001-silence-SolarMutex-not-locked-spew.patch
 Patch118: 0001-Resolves-rhbz-799525-put-flat-odf-mimetypes-in-xsltf.patch
 Patch119: 0001-Disable-problematic-reading-of-external-entities-in-.patch
 Patch120: 0001-Splash-screen-fix-for-multi-head-on-Linux-fdo-33214.patch
+Patch121: 0001-Resolves-rhbz-800272-complain-about-unknown-command-.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -1156,6 +1157,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch118 -p1 -b .rhbz-799525-put-flat-odf-mimetypes-in-xsltf.patch
 %patch119 -p1 -b .Disable-problematic-reading-of-external-entities-in-.patch
 %patch120 -p1 -b .Splash-screen-fix-for-multi-head-on-Linux-fdo-33214.patch
+%patch121 -p1 -b .rhbz-800272-complain-about-unknown-command-.patch
 
 # these are horribly incomplete--empty translations and copied english
 # strings with spattering of translated strings
@@ -2486,6 +2488,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 - Resolves: rhbz#799628 crash with chewing IM with g3g
 - Resolves: rhbz#799525 put flat odf mimetypes in xsltfilter.desktop
 - Resolves: rhbz#784198 show splash screen correctly on multi-head system
+- Resolves: rhbz#800272 complain about unknown commandline options
 
 * Wed Feb 29 2012 Caolán McNamara <caolanm at redhat.com> - 3.4.5.2-7
 - Resolves: rhbz#788045 swriter --help wouldn't display help


More information about the scm-commits mailing list