1 /* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
2 * This file is part of the S-Lang library.
4 * Trimmed down for use in GNU Midnight Commander.
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Perl Artistic License.
14 const int SLang_Version
= SLANG_VERSION
;
16 /* p and ch may point to the same buffer */
17 char *_SLexpand_escaped_char(char *p
, char *ch
)
20 int max
= 0, num
, base
= 0;
27 default: num
= ch1
; break;
28 case 'n': num
= '\n'; break;
29 case 't': num
= '\t'; break;
30 case 'v': num
= '\v'; break;
31 case 'b': num
= '\b'; break;
32 case 'r': num
= '\r'; break;
33 case 'f': num
= '\f'; break;
34 case 'E': case 'e': num
= 27; break;
39 case '0': case '1': case '2': case '3':
40 case '4': case '5': case '6': case '7':
42 base
= 8; i
= 2; num
= ch1
- '0';
45 case 'd': /* decimal -- S-Lang extension */
64 if ((ch1
<= max
) && (ch1
>= '0'))
66 num
= base
* num
+ (ch1
- '0');
71 if ((ch1
< 'a') || ((ch1
> 'f'))) break;
72 num
= base
* num
+ 10 + (ch1
- 'a');