You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2012/02/06 19:12:36 UTC

svn commit: r1241101 - in /commons/proper/daemon/branches/1.0.x/src: native/windows/src/cmdline.c site/xdoc/procrun.xml

Author: mturk
Date: Mon Feb  6 18:12:36 2012
New Revision: 1241101

URL: http://svn.apache.org/viewvc?rev=1241101&view=rev
Log:
Revert last DAEMON-240 fix and impplement alternative one that resets the option parser. Also document all possible scenarios

Modified:
    commons/proper/daemon/branches/1.0.x/src/native/windows/src/cmdline.c
    commons/proper/daemon/branches/1.0.x/src/site/xdoc/procrun.xml

Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/src/cmdline.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/src/cmdline.c?rev=1241101&r1=1241100&r2=1241101&view=diff
==============================================================================
--- commons/proper/daemon/branches/1.0.x/src/native/windows/src/cmdline.c (original)
+++ commons/proper/daemon/branches/1.0.x/src/native/windows/src/cmdline.c Mon Feb  6 18:12:36 2012
@@ -180,19 +180,19 @@ LPAPXCMDLINE apxCmdlineParse(
                     break;
                 }
                 if (add) {
-                    if (lpOptions[l].dwType & APXCMDOPT_FOUND) {
-                        apxLogWrite(APXLOG_MARK_ERROR "Option ++%S found after --%S. "
-                                    "Intermixing --option and ++option is not allowed",
-                                    a + 2, a + 2);
-                        return NULL;
+                    if (!(lpOptions[l].dwType & APXCMDOPT_FOUND)) {
+                        /* Only set add flag in case there was no --option
+                         */
+                        lpOptions[l].dwType |= APXCMDOPT_ADD;
                     }
-                    lpOptions[l].dwType |= APXCMDOPT_ADD;
                 }
                 else if (lpOptions[l].dwType & APXCMDOPT_ADD) {
-                     apxLogWrite(APXLOG_MARK_ERROR "Option --%S found after ++%S. "
-                                    "Intermixing --option and ++option is not allowed",
-                                 a + 2, a + 2);
-                     return NULL;
+                    /* We have ++option --option ...
+                     * Discard earlier values and go over.
+                     */
+                     lpOptions[l].dwType &= ~APXCMDOPT_ADD;
+                     lpOptions[l].dwValue = 0;
+                     lpOptions[l].szValue = 0;
                 }
                 if (lpOptions[l].dwType & APXCMDOPT_STR)
                     lpOptions[l].szValue = val;

Modified: commons/proper/daemon/branches/1.0.x/src/site/xdoc/procrun.xml
URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/site/xdoc/procrun.xml?rev=1241101&r1=1241100&r2=1241101&view=diff
==============================================================================
--- commons/proper/daemon/branches/1.0.x/src/site/xdoc/procrun.xml (original)
+++ commons/proper/daemon/branches/1.0.x/src/site/xdoc/procrun.xml Mon Feb  6 18:12:36 2012
@@ -217,7 +217,7 @@ However some parameters can take multipl
 If these parameters are prefixed with <b>++</b>, then the value will be appended to the existing value.
 For example:
 <source>
---Startup=manual --Startup=auto ++JvmOptions=-Done=1 ++JvmOptions=-Dtwo=2
+--Startup=manual --Startup=auto --JvmOptions=-Done=1 ++JvmOptions=-Dtwo=2
 </source>
 will result in the following values being used:
 <source>
@@ -234,9 +234,51 @@ Only multi-valued parameters support thi
 If <b><code>++</code></b> is used for a parameter that does not support multiple values,
 then it is treated the same as <b><code>--</code></b>. No error is reported.
 <br/>
-<b>Notice:</b><br/>
-It is error to intermix <b><code>++</code></b> and <b><code>--</code></b> options on the same
-command line. Staring with version <b>1.0.9</b> procrun will refuse to continue in such cases.
+Configuration is overwritten in case <b><code>--</code></b> is used.
+For example:
+<source>
+--JvmOptions=-Dthree=3 ++JvmOptions=-Dfour=4
+</source>
+will always overwrite the JvmOptions. The resulting configuration will be:
+<source>
+Startup:
+auto
+
+JvmOptions:
+-Dthree=3
+-Dfour=4
+</source>
+However if on  <b><code>++</code></b> is used the values will be appended. For example calling the
+following after the first example
+<source>
+++JvmOptions=-Dthree=3 ++JvmOptions=-Dfour=2
+</source>
+will result in the following values being used:
+<source>
+Startup:
+auto
+
+JvmOptions:
+-Done=1
+-Dtwo=2
+-Dthree=3
+-Dfour=4
+</source>
+<br/>
+In case you intermix the <b><code>++</code></b> and <b><code>--</code></b> options, the
+last <b><code>--</code></b> parameter will cause option reset. For example:
+<source>
+--Startup=manual --Startup=auto --JvmOptions=-Done=1 ++JvmOptions=-Dtwo=2 --JvmOptions=-Dthree=3 ++JvmOptions=-Dfour=2
+</source>
+will result in the following values being used:
+<source>
+Startup:
+auto
+
+JvmOptions:
+-Dthree=3
+-Dfour=4
+</source>
 </p>
 <p>
 When updating a service (//US or update command), using <b><code>--</code></b>