Simplify the logic of `"' further a bit, NFCI - 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 ed27c76334aaf8e4de69097fd7bfaf92ffc85afd
(DIR) parent 15cc17278b19026cf5d1688a817c1894550eedc8
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Wed, 26 Jun 2019 01:14:37
Simplify the logic of `"' further a bit, NFCI
Diffstat:
csvtofsv.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff -r 15cc17278b19 -r ed27c76334aa csvtofsv.c
--- a/csvtofsv.c Wed Jun 26 01:05:46 2019 +0200
+++ b/csvtofsv.c Wed Jun 26 01:14:37 2019 +0200
@@ -46,11 +46,10 @@
if (first) {
quoted = true;
first = false;
+ } else if (!quoted) {
+ putchar(c);
} else if ((nc = getchar()) != EOF) {
- if (!quoted) {
- putchar(c);
- ungetc(nc, stdin);
- } else if (nc == '"') {
+ if (nc == '"') {
putchar('"');
} else if (nc == ',') {
putchar(FS);