summaryrefslogtreecommitdiff
path: root/usr/src/lib/libast/common/man/ast.3
blob: 8055be9dbc5e91432cd030ca28d9d9e900fb9c6f (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
.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 AST 3
.SH NAME
ast \- miscellaneous libast support
.SH SYNOPSIS
.EX
#include <ast.h>

char*          astconf(const char* \fIname\fP, const char* \fIpath\fP, const char* \fIvalue\fP);
Ast_confdisc_t astconfdisc(Ast_confdisc_t new_notify);
void           astconflist(Sfio_t* stream, const char* path, int flags);
off_t          astcopy(int \fIrfd\fP, int \fIwfd\fP, off_t \fIn\fP);
int            astquery(int \fIfd\fP, const char* \fIformat\fP , ...);
.EE
.SH DESCRIPTION
.L astconf
is a string interface to the
.IR confstr (2),
.IR pathconf (2),
and
.IR sysconf (2)
calls.
If
.I value
is
.L 0
then the configuration parameter value for
.I name
is returned.
Some
.I name
configuration parameters may consult the
.I path
argument.
In this case if
.I path
is
.L 0
then
\f5"/"\fP
is used.
Otherwise if 
.I path
is not
.L 0
then it must exist.
The string return value for
.I name
remains unchanged until the next
.L astconf
call on
.IR name .
If
.I value
is
.L 0
then a valid string is always returned;
\f5""\fP
is returned if
.I name
has no configuration value.
This simplifies the programming interface:
.EX
if (!strcmp(astconf("PATH_RESOLVE", NiL, NiL), "logical"))
	/* the logical way ... */
.EE
If
.I value
is not
.L 0
then the configuration parameter value for
.I name
is set to
.IR value .
.L 0
is returned if the value cannot be set.
The paradigm is:
.EX
universe = astconf("UNIVERSE", 0, "att");
\|.\|.\|.
astconf("UNIVERSE", 0, universe);
.EE
The settable configuration names are:
.TP
.L FS_3D
.L 1
if
.IR 3d (1)
viewpathing is enabled,
.L 0
otherwise.
This is an alternative to the
.IR fs3d (3)
interface.
.TP
.L PATH_RESOLVE
.L logical
if symbolic links are followed during file tree traversal,
.L physical
if symbolic links are not followed during file tree traversal,
and
.L metaphysical
if symbolic links are followed at the top level during file tree traversal.
These correspond to the generic
.LR \-L ,
.LR \-P ,
and
.L \-H
command options.
.TP
.L UNIVERSE
.L ucb
for 
.I Berkeley
style and
.L att
otherwise.
This configuration parameter controls the
.I universe
setting on machines that support it (e.g., Pyramid).
.L UNIVERSE
also controls the behavior of some commands like
.IR cat (1)
and
.IR echo (1).
.PP
User defined
.I name
values may also be set and queried, but these should probably have
some form of vendor prefix to avoid being stomped by future standards.
.PP
.L astconfdisc
registers a discipline function
.EX
int (*notify)(const char* \fIname\fP, const char* \fIpath\fP, const char* \fIvalue\fP);
.EE
that is called just before the configuration parameter
.I name
is set to
.I value
relative to
.IR path .
If
.I notify
returns 
.L 0
then the configuration parameter value is not changed.
.PP
.L astconflist
lists the current configuration names and values of
.IR stream .
If
.I path
is
.L 0
then \f5"/"\fP is used where appropriate.
If
.I flags
is
.L 0
or
.L R_OK|W_OK
then all configuration parameters are listed.
.L R_OK
lists the readonly configuration parameters and 
.L W_OK
lists the settable configuration parameters.
.L X_OK
lists the settable configuration parameters in a form that can be
snarfed for input to the
.IR getconf (1)
command.
.PP
.L astcopy
efficiently copies up to
.I n
bytes from the file descriptor
.I rfd
to the file descriptor
.IR wfd .
The actual number of bytes copied is returned; \-1 is returned on error.
If
.I n
is  0 then an optimal number of bytes (with respect to both
.I rfd
and
.IR wfd )
is copied.
.PP
If possible
.IR mmap (2)
is used to do the transfer.
Some implementations may bypass user buffer copies usually required by the
.IR read (2)- write (2)
paradigm.
.PP
.L astquery
outputs an
.IR sfprintf (3)
prompt specified by
.I "format, .\|.\|."
to the controlling terminal and reads a response from the controlling terminal.
Offirmative response returns
.LR 0 ,
.L EOF
or quit response returns
.LR \-1 ,
otherwise
.L 1
is returned.
If
.I quit
is greater than
.L 0
then
.I exit(quit)
is called on a quit response.
The responses will eventually be locale specific.
.PP
.L astwinsize
returns the number of rows in
.I *rows
and the number of columns
.I *col
for the terminal file descriptor
.IR fd .
If the number of rows or columns cannot be determined or if
.I fd
is not a terminal then
.I *rows
and
.I *cols
are set to
.LR 0 .
If
.I ioctl (2)
methods fail then the environment variable
.L LINES
is used to set
.I *rows
and the environment variable
.L COLUMNS
is used to set
.IR *cols .
.SH "SEE ALSO"
getconf(1), confstr(2), mmap(2), pathconf(2), read(2), sysconf(2), write(2)