Allow '--' to specify '-' as an action parameter

This commit is contained in:
Tom Eastep 2010-12-26 17:03:05 -08:00
parent 4111432a52
commit 79cbfd0126
3 changed files with 8 additions and 3 deletions

View File

@ -1800,7 +1800,8 @@ sub push_params( $ ) {
for ( my $i = 1; $i <= @params; $i++ ) { for ( my $i = 1; $i <= @params; $i++ ) {
my $val = $params[$i - 1]; my $val = $params[$i - 1];
$actparms{$i} = $val eq '-' ? '' : $val;
$actparms{$i} = $val eq '-' ? '' : $val eq '--' ? '-' : $val;
} }
$oldparams; $oldparams;

View File

@ -131,7 +131,8 @@ Beta 1
You can 'omit' a parameter in the list by using '-' (e,g, You can 'omit' a parameter in the list by using '-' (e,g,
REDIRECT,-.info) would omit the second parameter (within the action REDIRECT,-.info) would omit the second parameter (within the action
body, $2 would expand to nothing). body, $2 would expand to nothing). If you want to specify '-' as an
parameter value, use '--'.
Parameter values are also available to extensions scripts. See Parameter values are also available to extensions scripts. See
http://www.shorewall.net/Actions.html#Extension for more http://www.shorewall.net/Actions.html#Extension for more

View File

@ -252,9 +252,12 @@ REDIRECT net - tcp 80 - 1.2.3.4</programlisting>
<para>You can 'omit' parameters by using '-'.</para> <para>You can 'omit' parameters by using '-'.</para>
<para>Example: ACTION(REDIRECT,-,info) </para> <para>Example: ACTION(REDIRECT,-,info)</para>
<para>In the above example, $2 would expand to nothing.</para> <para>In the above example, $2 would expand to nothing.</para>
<para>If you want to make '-' a parameter value, use '--' (e.g.,
ACTION(REDIRECT,--.info)).</para>
</section> </section>
<section> <section>