From b690a53ed619f5adfa532bf8cc9ab13c1c806b3c Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 2 Aug 2020 15:25:43 +0100 Subject: [PATCH] Fix lsearch ret=full --- src/src/lookups/lsearch.c | 2 +- test/scripts/0000-Basic/0002 | 14 +++++++------- test/stdout/0002 | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c index 4da422e9e..10927dd82 100644 --- a/src/src/lookups/lsearch.c +++ b/src/src/lookups/lsearch.c @@ -154,7 +154,7 @@ for (BOOL this_is_eol, last_was_eol = TRUE; linekeylength = t - buffer; if (*s) s++; /* Past terminating " */ if (ret_full) - Ustrcpy(t, s); /* copy the rest of line does also */ + memmove(t, s, Ustrlen(s)+1); /* copy the rest of line also */ } /* Otherwise it is terminated by a colon or white space */ diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002 index 4d170ec68..70b4e5f94 100644 --- a/test/scripts/0000-Basic/0002 +++ b/test/scripts/0000-Basic/0002 @@ -563,13 +563,13 @@ q5: ${lookup{"quoted"} lsearch{DIR/aux-fixed/0002.quoted}} q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}} q7: ${lookup{b\\s} lsearch{DIR/aux-fixed/0002.quoted}} -q1: ${lookup{abc} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} -q2: ${lookup{xyz} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} -q3: ${lookup{pqr} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} -q4: ${lookup{a:b} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} -q5: ${lookup{"quoted"} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} -q6: ${lookup{white space}lsearch,ret=full{DIR/aux-fixed/0002.quoted}} -q7: ${lookup{b\\s} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q1f: ${lookup{abc} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q2f: ${lookup{xyz} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q3f: ${lookup{pqr} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q4f: ${lookup{a:b} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q5f: ${lookup{"quoted"} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q6f: ${lookup{white space}lsearch,ret=full{DIR/aux-fixed/0002.quoted}} +q7f: ${lookup{b\\s} lsearch,ret=full{DIR/aux-fixed/0002.quoted}} abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}} a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}} diff --git a/test/stdout/0002 b/test/stdout/0002 index df659d2d4..02ba087ba 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -527,13 +527,13 @@ newline tab\134backslash ~tilde\177DEL\200\201. > q6: "white space" > q7: "b\\s" > -> q1: abc "abc" -> q2: xyz: "xyz": -> q3: pqr : "pqr" : -> q4: a:b "a:b" abc continued data (make sure not key) -> q5: "quoted" "\"quoted\"" -> q6: white space "white space" -> q7: b\s "b\\s" +> q1f: abc "abc" +> q2f: xyz: "xyz": +> q3f: pqr : "pqr" : +> q4f: a:b "a:b" abc continued data (make sure not key) +> q5f: "quoted" "\"quoted\"" +> q6f: white space "white space" +> q7f: b\s "b\\s" > > abc: abc > a.b.c: *.b.c -- 2.30.2