| AST(3) | C LIBRARY FUNCTIONS | AST(3) |
|---|
#include <ast.h>char* astconf(const char* name, const char* path, const char* value); Ast_confdisc_t astconfdisc(Ast_confdisc_t new_notify); void astconflist(Sfio_t* stream, const char* path, int flags); off_t astcopy(int rfd, int wfd, off_t n); int astquery(int fd, const char* format , ...);
if (!strcmp(astconf("PATH_RESOLVE", NiL, NiL), "logical"))
/* the logical way ... */
universe = astconf("UNIVERSE", 0, "att");
. . .
astconf("UNIVERSE", 0, universe);
User defined 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.
astconfdisc registers a discipline function
int (*notify)(const char* name, const char* path, const char* value);
astconflist
lists the current configuration names and values of
stream.
If
path
is
0
then "/" is used where appropriate.
If
flags
is
0
or
R_OK|W_OK
then all configuration parameters are listed.
R_OK
lists the readonly configuration parameters and
W_OK
lists the settable configuration parameters.
X_OK
lists the settable configuration parameters in a form that can be
snarfed for input to the
astcopy efficiently copies up to n bytes from the file descriptor rfd to the file descriptor wfd. The actual number of bytes copied is returned; -1 is returned on error. If n is 0 then an optimal number of bytes (with respect to both rfd and wfd) is copied.
If possible
astquery
outputs an
astwinsize returns the number of rows in *rows and the number of columns *col for the terminal file descriptor fd. If the number of rows or columns cannot be determined or if fd is not a terminal then *rows and *cols are set to 0. If ioctl (2) methods fail then the environment variable LINES is used to set *rows and the environment variable COLUMNS is used to set *cols.
| November 07, 2006 |