FreeCalypso > hg > fc-pcsc-tools
diff libcommon/alpha_fromfile.c @ 20:90e7020df08a
GSM7 string parsers accept new bypass-encoding escapes
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 12 Feb 2021 03:44:59 +0000 |
parents | 2ef261371347 |
children |
line wrap: on
line diff
--- a/libcommon/alpha_fromfile.c Fri Feb 12 03:33:26 2021 +0000 +++ b/libcommon/alpha_fromfile.c Fri Feb 12 03:44:59 2021 +0000 @@ -33,13 +33,20 @@ if (*cp == '\0') goto unterm_qstring; c = *cp++; + if (c >= '0' && c <= '7' && isxdigit(*cp)) { + c = ((c - '0') << 4) | decode_hex_digit(*cp++); + goto bypass_encoding; + } switch (c) { case 'n': c = '\n'; - break; + goto bypass_encoding; case 'r': c = '\r'; - break; + goto bypass_encoding; + case 'e': + c = 0x1B; + goto bypass_encoding; case '"': case '\\': break; @@ -57,6 +64,7 @@ filename_for_errs, lineno_for_errs); return(0); } +bypass_encoding: if (c & 0x80) nadd = 2; else