summaryrefslogtreecommitdiff
path: root/src/lib/libast/man/chr.3
blob: 8d57648b49188f1c491b773a307fa0412a670e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.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)