xref: /titanic_51/usr/src/lib/libast/common/man/ast.3 (revision e71ca95ca6de23d33b54cb55cefdef30bc7c969b)
.fp 5 CW .. .nr ;G \\n(.f .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" \\*(;G .. .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" ..

0

..

..

AST 3
NAME
ast - miscellaneous libast support
SYNOPSIS
.EX #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 , ...);
DESCRIPTION
.L astconf is a string interface to the confstr (2), pathconf (2), and sysconf (2) calls. If value is .L 0 then the configuration parameter value for name is returned. Some name configuration parameters may consult the path argument. In this case if path is .L 0 then \f5"/" is used. Otherwise if path is not .L 0 then it must exist. The string return value for name remains unchanged until the next .L astconf call on name . If value is .L 0 then a valid string is always returned; \f5"" is returned if name has no configuration value. This simplifies the programming interface: .EX if (!strcmp(astconf("PATH_RESOLVE", NiL, NiL), "logical")) /* the logical way ... */ If value is not .L 0 then the configuration parameter value for name is set to value . .L 0 is returned if the value cannot be set. The paradigm is: .EX universe = astconf("UNIVERSE", 0, "att"); \|.\|.\|. astconf("UNIVERSE", 0, universe); The settable configuration names are:

.L FS_3D .L 1 if 3d (1) viewpathing is enabled, .L 0 otherwise. This is an alternative to the fs3d (3) interface.

.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.

.L UNIVERSE .L ucb for Berkeley style and .L att otherwise. This configuration parameter controls the universe setting on machines that support it (e.g., Pyramid). .L UNIVERSE also controls the behavior of some commands like cat (1) and echo (1).

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.

.L astconfdisc registers a discipline function .EX int (*notify)(const char* name, const char* path, const char* value); that is called just before the configuration parameter name is set to value relative to path . If notify returns .L 0 then the configuration parameter value is not changed.

.L astconflist lists the current configuration names and values of stream . If path is .L 0 then \f5"/" is used where appropriate. If 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 getconf (1) command.

.L 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 mmap (2) is used to do the transfer. Some implementations may bypass user buffer copies usually required by the read (2)- write (2) paradigm.

.L astquery outputs an sfprintf (3) prompt specified by "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 quit is greater than .L 0 then exit(quit) is called on a quit response. The responses will eventually be locale specific.

.L 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 .LR 0 . If ioctl (2) methods fail then the environment variable .L LINES is used to set *rows and the environment variable .L COLUMNS is used to set *cols .

"SEE ALSO"
getconf(1), confstr(2), mmap(2), pathconf(2), read(2), sysconf(2), write(2)