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.
This commit is contained in:
Holger Vogt 2019-09-03 10:51:15 +02:00
parent 88008af088
commit 9543a5644c
1 changed files with 9 additions and 1 deletions

View File

@ -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