Browse Source

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.
pre-master-46
Holger Vogt 7 years ago
parent
commit
9543a5644c
  1. 10
      src/frontend/inpcom.c

10
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

Loading…
Cancel
Save