Introduction
Introduction Statistics Contact Development Disclaimer Help
print \n or \t also when using -F or -R - json2tsv - JSON to TSV converter
git clone git://git.codemadness.org/json2tsv
Log
Files
Refs
README
LICENSE
---
commit fea1a2013f259f23798d9a611f783f25b4f7448d
parent 65ee8e6903bc3c072a2e55fdd2501b0296fbdf59
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 25 Sep 2021 11:37:20 +0200
print \n or \t also when using -F or -R
\n or \t is a control-character, but the intention of suppressing them by
default is to not mess with the terminal (-r can be used to enable it).
Diffstat:
M json2tsv.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/json2tsv.c b/json2tsv.c
@@ -42,11 +42,20 @@ void
rs_printvalue(const char *s)
{
for (; *s; s++) {
- /* ignore other control chars */
- if ((!rflag && iscntrl((unsigned char)*s)) ||
- *s == fs || *s == rs)
+ if (*s == fs || *s == rs)
continue;
- putchar(*s);
+
+ switch (*s) {
+ case '\n':
+ case '\t':
+ putchar(*s);
+ break;
+ default:
+ /* ignore other control chars */
+ if (!rflag && iscntrl((unsigned char)*s))
+ continue;
+ putchar(*s);
+ }
}
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.