aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/sed/transform.c8
-rw-r--r--tests/sed.at9
2 files changed, 12 insertions, 5 deletions
diff --git a/modules/sed/transform.c b/modules/sed/transform.c
index 67e0de8..ec7983f 100644
--- a/modules/sed/transform.c
+++ b/modules/sed/transform.c
@@ -623,25 +623,25 @@ _single_transform_name_to_slist (struct transform *tr,
if (rc == 0)
{
struct replace_segm *segm;
disp = rmp[0].rm_eo;
- if (rmp[0].rm_so)
- if (transform_append (tr, slist, input, rmp[0].rm_so))
- return 1;
-
nmatches++;
if (tf->match_number && nmatches < tf->match_number)
{
if (transform_append (tr, slist, input, disp))
return 1;
input += disp;
continue;
}
+ if (rmp[0].rm_so)
+ if (transform_append (tr, slist, input, rmp[0].rm_so))
+ return 1;
+
for (segm = tf->repl_head; segm; segm = segm->next)
{
switch (segm->type)
{
case segm_literal: /* Literal segment */
if (case_ctl == ctl_stop)
diff --git a/tests/sed.at b/tests/sed.at
index 0f432c5..39dd99d 100644
--- a/tests/sed.at
+++ b/tests/sed.at
@@ -6,18 +6,25 @@
AT_SETUP([sed])
AT_DATA([smapd.conf],
[idle-timeout 10
module sed sed
database dequote sed 's/<(.*)>/\1/g'
database default sed 's/ok-(.*)/\1/'
+database n sed 's/s/@/2'
+database g sed 's/s/@/2g'
+dispatch map eq n database n
+dispatch map eq g database g
dispatch key like <*> transform key dequote
dispatch default database default
])
-AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>'
+AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>' n password g passwords
],
[0],
[test ok-word: OK word
test word: NOTFOUND
test <ok-word>: OK word
+n password: OK pas@word
+g passwords: OK pas@word@
])
+
AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.