Introduction
Introduction Statistics Contact Development Disclaimer Help
compatibility: replace iscntrl with own ISCNTRL macro - json2tsv - JSON to TSV …
git clone git://git.codemadness.org/json2tsv
Log
Files
Refs
README
LICENSE
---
commit 1ebc23030bb37e0f9399328ec3a6968e35758351
parent ca7aea61b3a593c782c7da48ec3e6552b47a698e
Author: Hiltjo Posthuma <[email protected]>
Date: Mon, 28 Mar 2022 18:42:11 +0200
compatibility: replace iscntrl with own ISCNTRL macro
It is unspecified if the C locale iscntrl is compatible with ASCII or not so
force it to be.
Diffstat:
M json2tsv.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/json2tsv.c b/json2tsv.c
@@ -14,6 +14,9 @@
#include "json.h"
+/* control-character in the ASCII range 0-127: compatible with UTF-8 */
+#define ISCNTRL(c) ((c) < ' ' || (c) == 0x7f)
+
static int nflag = 0; /* -n flag: show indices count for arrays */
static int rflag = 0; /* -r flag: show all control-characters */
static int fs = '\t', rs = '\n';
@@ -31,7 +34,7 @@ tsv_printvalue(const char *s)
case '\t': putchar('\\'); putchar('t'); break;
default:
/* ignore other control chars */
- if (!rflag && iscntrl((unsigned char)*s))
+ if (!rflag && ISCNTRL((unsigned char)*s))
continue;
putchar(*s);
}
@@ -52,7 +55,7 @@ rs_printvalue(const char *s)
break;
default:
/* ignore other control chars */
- if (!rflag && iscntrl((unsigned char)*s))
+ 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.