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

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


commit 4cf2714f5e4b926e8399bcd1c84c8d346d632d85
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 6 15:54:14 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 15eb151..7b9a162 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -133,6 +133,7 @@ Patch19: 0001-Resolves-rhbz-788045-swriter-help-etc-doesn-t-show-h.patch
 Patch20: 0001-Related-rhbz-799628-crash-with-chewing-IM-with-g3g.patch
 Patch21: 0001-silence-SolarMutex-not-locked-spew.patch
 Patch22: 0001-Resolves-rhbz-799525-put-flat-odf-mimetypes-in-xsltf.patch
+Patch23: 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}
@@ -976,6 +977,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch20 -p1 -b .rhbz-799628-crash-with-chewing-IM-with-g3g.patch
 %patch21 -p1 -b .silence-SolarMutex-not-locked-spew.patch
 %patch22 -p1 -b .rhbz-799525-put-flat-odf-mimetypes-in-xsltf.patch
+%patch23 -p1 -b .rhbz-800272-complain-about-unknown-command-.patch
 
 # TODO: check this
 # these are horribly incomplete--empty translations and copied english
@@ -2258,6 +2260,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 * Tue Mar 06 2012 Caolán McNamara <caolanm at redhat.com> - 3.5.1.1-3
 - Resolves: rhbz#799628 crash with chewing IM with g3g
 - Resolves: rhbz#799525 put flat odf mimetypes into xsltfilter.desktop
+- Resolves: rhbz#800272 complain about unknown commandline options
 
 * Wed Feb 29 2012 Caolán McNamara <caolanm at redhat.com> - 3.5.1.1-2
 - Resolves: rhbz#788045 swriter --help doesn't show help


More information about the scm-commits mailing list