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,
623 if (rc == 0) 623 if (rc == 0)
624 { 624 {
625 struct replace_segm *segm; 625 struct replace_segm *segm;
626 626
627 disp = rmp[0].rm_eo; 627 disp = rmp[0].rm_eo;
628 628
629 if (rmp[0].rm_so)
630 if (transform_append (tr, slist, input, rmp[0].rm_so))
631 return 1;
632
633 nmatches++; 629 nmatches++;
634 if (tf->match_number && nmatches < tf->match_number) 630 if (tf->match_number && nmatches < tf->match_number)
635 { 631 {
636 if (transform_append (tr, slist, input, disp)) 632 if (transform_append (tr, slist, input, disp))
637 return 1; 633 return 1;
638 input += disp; 634 input += disp;
639 continue; 635 continue;
640 } 636 }
641 637
638 if (rmp[0].rm_so)
639 if (transform_append (tr, slist, input, rmp[0].rm_so))
640 return 1;
641
642 for (segm = tf->repl_head; segm; segm = segm->next) 642 for (segm = tf->repl_head; segm; segm = segm->next)
643 { 643 {
644 switch (segm->type) 644 switch (segm->type)
645 { 645 {
646 case segm_literal: /* Literal segment */ 646 case segm_literal: /* Literal segment */
647 if (case_ctl == ctl_stop) 647 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 @@
6AT_SETUP([sed]) 6AT_SETUP([sed])
7AT_DATA([smapd.conf], 7AT_DATA([smapd.conf],
8[idle-timeout 10 8[idle-timeout 10
9module sed sed 9module sed sed
10database dequote sed 's/<(.*)>/\1/g' 10database dequote sed 's/<(.*)>/\1/g'
11database default sed 's/ok-(.*)/\1/' 11database default sed 's/ok-(.*)/\1/'
12database n sed 's/s/@/2'
13database g sed 's/s/@/2g'
14dispatch map eq n database n
15dispatch map eq g database g
12dispatch key like <*> transform key dequote 16dispatch key like <*> transform key dequote
13dispatch default database default 17dispatch default database default
14]) 18])
15AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>' 19AT_CHECK([smaptest -c smapd.conf test ok-word test word test '<ok-word>' n password g passwords
16], 20],
17[0], 21[0],
18[test ok-word: OK word 22[test ok-word: OK word
19test word: NOTFOUND 23test word: NOTFOUND
20test <ok-word>: OK word 24test <ok-word>: OK word
25n password: OK pas@word
26g passwords: OK pas@word@
21]) 27])
28
22AT_CLEANUP 29AT_CLEANUP
23 30

Return to:

Send suggestions and report system problems to the System administrator.