.fp 5 CW
.de Af
.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
..
.de aF
.ie \\$3 .ft \\$1
.el \{\
.ds ;G \&
.nr ;G \\n(.f
.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
\\*(;G
.ft \\n(;G \}
..
.de L
.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
..
.de LR
.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
..
.de RL
.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
..
.de EX \" start example
.ta 1i 2i 3i 4i 5i 6i
.PP
.RS
.PD 0
.ft 5
.nf
..
.de EE \" end example
.fi
.ft
.PD
.RE
.PP
..
.TH CHR 3
.SH NAME
chr \- character constant conversion routines
.SH SYNOPSIS
.EX
#include <ast.h>
int chresc(const char* \fIs\fP, char** \fIe\fP);
int chrtoi(const char* \fIs\fP);
.EE
.SH DESCRIPTION
.L chresc
converts and returns the next character constant in the 0-terminated string
.IR s .
If
.I e
is not 0 then
.I *e
is set to point to the next character in
.I s
on return.
0 is returned and
.I e
is not modified when the end of
.I s
is reached.
.PP
.L chrtoi
converts the 0-terminated string
.I s
to an
.I int
and returns the value.
The characters in
.I s
are converted in order from the left and shifted into the
.I int
value until up to the number of characters in an
.I int
is reached.
This operation is inherently machine-dependent,
but at least its defined in one place.
.PP
The following
.B \e
escape sequences are recognized:
.TP
.RI \e ooo
The character represented by the octal code
.IR ooo .
.TP
.RI \ex xx
The character represented by the hex code
.IR xx .
.TP
.L \ea
Alert (bell).
.TP
.L \eb
Backspace.
.TP
.L \ef
Formfeed.
.TP
.L \en
Newline.
.TP
.L \er
Carriage return.
.TP
.L \et
Horizontal tab.
.TP
.L \ev
Vertical tab.
.TP
.L \eE
ESC (escape).
.TP
.L \e\e
Backslash.
.PP
Other characters following
.B \e
are undefined (although for backwards compatibility they
translate to themselves).
.SH "SEE ALSO"
str(3)