From 9543a5644cc3d1e4244308b326f8bb80210d7035 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 3 Sep 2019 10:51:15 +0200 Subject: [PATCH] Improve handling of non-printable characters (esp. for Linux) If there is an isolated non-printable character leading the line, convert it to *. In fact there are some, e.g. in device lib TL072.301 from TI. --- src/frontend/inpcom.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index ce263fd20..67ac6f920 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2293,12 +2293,20 @@ static char *inp_spawn_brace(char *s) /*-------------------------------------------------------------------------* removes " " quotes, returns lower case letters, - replaces non-printable characterss with '_' * + replaces non-printable characterss with '_', however if + non-printable character is the only character in a line, + replace it by '*' *-------------------------------------------------------------------------*/ void inp_casefix(char *string) { #ifdef HAVE_CTYPE_H + /* single non-printable character */ + if(string && !isspace_c(*string) && !isprint_c(*string) && + (string[1] == '\0' || isspace_c(string[1]))) { + *string = '*'; + return; + } if (string) while (*string) { #ifdef HAS_ASCII