---
name: "ast"
section: "3"
platform: "macos"
package: "ksh"
version: "42"
release: "macOS 26.5"
platforms: ["macos"]
url: "https://new.carta.tech/ast"
---

# ast(3)

miscellaneous libast support

## NAME

ast - miscellaneous libast support

## SYNOPSIS

```
#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

$1$2astconfastconfastconfastconfastconfastconfastconfastconf is a string interface to the *confstr*(2), [*pathconf*(2)](/pathconf/2.md), and *sysconf*(2) calls. If *value* is $1$200000000 then the configuration parameter value for *name* is returned. Some *name* configuration parameters may consult the *path* argument. In this case if *path* is $1$200000000 then "/" is used. Otherwise if  *path* is not $1$200000000 then it must exist. The string return value for *name* remains unchanged until the next $1$2astconfastconfastconfastconfastconfastconfastconfastconf call on *name*. If *value* is $1$200000000 then a valid string is always returned; "" is returned if *name* has no configuration value. This simplifies the programming interface:

```
if (!strcmp(astconf("PATH_RESOLVE", NiL, NiL), "logical"))
	/* the logical way ... */
```

If *value* is not $1$200000000 then the configuration parameter value for *name* is set to *value*. $1$200000000 is returned if the value cannot be set. The paradigm is:

```
universe = astconf("UNIVERSE", 0, "att");
...
astconf("UNIVERSE", 0, universe);
```

The settable configuration names are:

- $1$2FS\_3DFS\_3DFS\_3DFS\_3DFS\_3DFS\_3DFS\_3DFS\_3D

  $1$211111111 if *3d*(1) viewpathing is enabled, $1$200000000 otherwise. This is an alternative to the [*fs3d*(3)](/fs3d/3.md) interface.

- $1$2PATH\_RESOLVEPATH\_RESOLVEPATH\_RESOLVEPATH\_RESOLVEPATH\_RESOLVEPATH\_RESOLVEPATH\_RESOLVEPATH\_RESOLVE

  $1$2logicallogicallogicallogicallogicallogicallogicallogical if symbolic links are followed during file tree traversal, $1$2physicalphysicalphysicalphysicalphysicalphysicalphysicalphysical if symbolic links are not followed during file tree traversal, and $1$2metaphysicalmetaphysicalmetaphysicalmetaphysicalmetaphysicalmetaphysicalmetaphysicalmetaphysical if symbolic links are followed at the top level during file tree traversal. These correspond to the generic $1$2-L-L-L-L-L-L-L-L $1$2-P-P-P-P-P-P-P-P and $1$2-H-H-H-H-H-H-H-H command options.

- $1$2UNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSE

  $1$2ucbucbucbucbucbucbucbucb for  *Berkeley* style and $1$2attattattattattattattatt otherwise. This configuration parameter controls the *universe* setting on machines that support it (e.g., Pyramid). $1$2UNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSEUNIVERSE also controls the behavior of some commands like [*cat*(1)](/cat/1.md) and [*echo*(1)](/echo/1.md).

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.

$1$2astconfdiscastconfdiscastconfdiscastconfdiscastconfdiscastconfdiscastconfdiscastconfdisc registers a discipline function

```
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*  $1$200000000 then the configuration parameter value is not changed.

$1$2astconflistastconflistastconflistastconflistastconflistastconflistastconflistastconflist lists the current configuration names and values of *stream*. If *path* is $1$200000000 then "/" is used where appropriate. If *flags* is $1$200000000 or $1$2R\_OK\|W\_OKR\_OK\|W\_OKR\_OK\|W\_OKR\_OK\|W\_OKR\_OK\|W\_OKR\_OK\|W\_OKR\_OK\|W\_OKR\_OK\|W\_OK then all configuration parameters are listed. $1$2R\_OKR\_OKR\_OKR\_OKR\_OKR\_OKR\_OKR\_OK lists the readonly configuration parameters and  $1$2W\_OKW\_OKW\_OKW\_OKW\_OKW\_OKW\_OKW\_OK lists the settable configuration parameters. $1$2X\_OKX\_OKX\_OKX\_OKX\_OKX\_OKX\_OKX\_OK lists the settable configuration parameters in a form that can be snarfed for input to the [*getconf*(1)](/getconf/1.md) command.

$1$2astcopyastcopyastcopyastcopyastcopyastcopyastcopyastcopy 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)](/mmap/2.md) is used to do the transfer. Some implementations may bypass user buffer copies usually required by the [*read*(2)](/read/2.md)-[*write*(2)](/write/2.md) paradigm.

$1$2astqueryastqueryastqueryastqueryastqueryastqueryastqueryastquery outputs an *sfprintf*(3) prompt specified by *format, ...* to the controlling terminal and reads a response from the controlling terminal. Offirmative response returns $1$200000000 $1$2EOFEOFEOFEOFEOFEOFEOFEOF or quit response returns $1$2-1-1-1-1-1-1-1-1 otherwise $1$211111111 is returned. If *quit* is greater than $1$200000000 then *exit(quit)* is called on a quit response. The responses will eventually be locale specific.

$1$2astwinsizeastwinsizeastwinsizeastwinsizeastwinsizeastwinsizeastwinsizeastwinsize 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 $1$200000000 If *ioctl (2)* methods fail then the environment variable $1$2LINESLINESLINESLINESLINESLINESLINESLINES is used to set *\*rows* and the environment variable $1$2COLUMNSCOLUMNSCOLUMNSCOLUMNSCOLUMNSCOLUMNSCOLUMNSCOLUMNS is used to set *\*cols*.

## SEE ALSO

[getconf(1)](/getconf/1.md), confstr(2), [mmap(2)](/mmap/2.md), [pathconf(2)](/pathconf/2.md), [read(2)](/read/2.md), sysconf(2), [write(2)](/write/2.md)
