Update the previous char read for last quoted field with \r\n ending - csvtofsv - Convert CSV to FSV (`fs' (0x1c) as FS and `rs' (0x1e) as RS)
(HTM) hg clone https://bitbucket.org/iamleot/csvtofsv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset 017ecd56401099a5229e4b0c79211cdcf060e3d8
(DIR) parent 7c9a170853ec8338aa66cd5b7587dcc81ade6f5d
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Thu, 27 Jun 2019 01:53:06
Update the previous char read for last quoted field with \r\n ending
This fixes bug exposed in test 12: when the last field was quoted and
with trailing \r\n, pc contained `\r' leading to the generation of a
spurious extra wrong record without any fields.
Diffstat:
csvtofsv.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff -r 7c9a170853ec -r 017ecd564010 csvtofsv.c
--- a/csvtofsv.c Thu Jun 27 01:48:36 2019 +0200
+++ b/csvtofsv.c Thu Jun 27 01:53:06 2019 +0200
@@ -73,6 +73,7 @@
} else if ((nc == '\n') ||
((nc == '\r') &&
((nc = getchar()) == '\n'))) {
+ pc = nc;
putchar(RS);
first = true;
quoted = false;