gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, feature/csv-revamp, updated. gawk-4.1.0-5193-gc7566d7


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/csv-revamp, updated. gawk-4.1.0-5193-gc7566d72
Date: Thu, 23 Mar 2023 14:01:39 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, feature/csv-revamp has been updated
       via  c7566d72409784c83759d638de5301e053aa4134 (commit)
      from  1bd176bda7d36289595c52e9eca4b906703899bf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c7566d72409784c83759d638de5301e053aa4134

commit c7566d72409784c83759d638de5301e053aa4134
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Mar 23 20:01:21 2023 +0200

    CSV input, string CRs.

diff --git a/ChangeLog b/ChangeLog
index 0f2cd3d5..a18b61c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2023-03-23         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * io.c (csvscan): Strip CRs.
+
 2023-03-21         Manuel Collado        <mcollado2011@gmail.com>
 
        * io.c (csvscan): Real implementation.
diff --git a/io.c b/io.c
index 2710db93..b8c89b6c 100644
--- a/io.c
+++ b/io.c
@@ -3854,7 +3854,15 @@ csvscan(IOBUF *iop, struct recmatch *recm, SCANSTATE 
*state)
        do {
                while (*bp != rs) { 
                        if (*bp == '\"')
-                               in_quote = !in_quote;
+                               in_quote = ! in_quote;
+                       else if (*bp == '\r') { // strip CRs
+                               size_t count = (iop->dataend - bp);
+
+                               // shift it all down by one
+                               memmove(bp, bp + 1, count);
+                               iop->dataend--;
+                               bp--;   // compensate for the upcoming bp++
+                       }
                        bp++;
                }
        } while (in_quote && bp < iop->dataend && bp++);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |  4 ++++
 io.c      | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]