1.fp 5 CW
2.de Af
3.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5..
6.de aF
7.ie \\$3 .ft \\$1
8.el \{\
9.ds ;G \&
10.nr ;G \\n(.f
11.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12\\*(;G
13.ft \\n(;G \}
14..
15.de L
16.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17..
18.de LR
19.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20..
21.de RL
22.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23..
24.de EX		\" start example
25.ta 1i 2i 3i 4i 5i 6i
26.PP
27.RS 
28.PD 0
29.ft 5
30.nf
31..
32.de EE		\" end example
33.fi
34.ft
35.PD
36.RE
37.PP
38..
39.TH CHR 3
40.SH NAME
41chr \- character constant conversion routines
42.SH SYNOPSIS
43.EX
44#include <ast.h>
45
46int          chresc(const char* \fIs\fP, char** \fIe\fP);
47int          chrtoi(const char* \fIs\fP);
48.EE
49.SH DESCRIPTION
50.L chresc
51converts and returns the next character constant in the 0-terminated string
52.IR s .
53If
54.I e
55is not 0 then
56.I *e
57is set to point to the next character in
58.I s
59on return.
600 is returned and 
61.I e
62is not modified when the end of
63.I s
64is reached.
65.PP
66.L chrtoi
67converts the 0-terminated string
68.I s
69to an
70.I int
71and returns the value.
72The characters in
73.I s
74are converted in order from the left and shifted into the
75.I int
76value until up to the number of characters in an
77.I int
78is reached.
79This operation is inherently machine-dependent,
80but at least its defined in one place.
81.PP
82The following 
83.B \e
84escape sequences are recognized:
85.TP
86.RI \e ooo
87The character represented by the octal code
88.IR ooo .
89.TP
90.RI \ex xx
91The character represented by the hex code
92.IR xx .
93.TP
94.L \ea
95Alert (bell).
96.TP
97.L \eb
98Backspace.
99.TP
100.L \ef
101Formfeed.
102.TP
103.L \en
104Newline.
105.TP
106.L \er
107Carriage return.
108.TP
109.L \et
110Horizontal tab.
111.TP
112.L \ev
113Vertical tab.
114.TP
115.L \eE
116ESC (escape).
117.TP
118.L \e\e
119Backslash.
120.PP
121Other characters following
122.B \e
123are undefined (although for backwards compatibility they
124translate to themselves).
125.SH "SEE ALSO"
126str(3)
127