ASTSA(3)
π NAME π
astsa β standalone libast support. Yep bestie, this is ASTSA(3) from the Library Functions Manual, and the whole page is about that standalone libast support vibe. β¨
β¨ SYNOPSIS β¨
#include <ast.h>
#include <ccode.h>
#include <error.h>
#include <option.h>
#include <stk.h>
π¦ DESCRIPTION π¦
Okay so astsa is a standalone subset of ast(3) that requires only cdt(3) and sfio(3). Slay. π«Ά
<ast.h> includes <ast_common.h>, <stdarg.h> or <varargs.h>, <sfio.h>, <limits.h>, and <limits.h> and <unistd.h> if supported by the local system. Yes, <limits.h> really shows up twice in the original lore β weβre keeping every detail, no edits, periodt. π
The macros and functions provided by <ast.h> are described below. The other headers are described in ccode(3), error(3), optget(3), and stk(3). πΈ
π MACROS π
π size_t elementsof(x)
Evaluates to the number of elements in the array variable x.
π type* newof(void* old, type, size_t elements, size_t extra)
Equivalent to (type*)realloc((char*)old,sizeof(type)*elements+extra) if old!=0, and equivalent to (type*)calloc(1,sizeof(type)*elements+extra) otherwise. Exact same expressions, no cap. β¨
π type* oldof(void* old, type, size_t elements, size_t extra)
Equivalent to (type*)realloc((char*)old,sizeof(type)*elements+extra) if old!=0, and equivalent to (type*)malloc(1,sizeof(type)*elements+extra) otherwise. Lowkey the same shape as newof, but the otherwise branch is malloc, not calloc. π
π size_t roundof(x,y)
Evaluates to x rounded up to the next power of 2 boundary y.
π int ssizeof(x)
Equivalent to (int)sizeof(x).
π int streq(a,b)
Equivalent to (*(a)==*(b)&&strcmp(a,b)==0).
π int strneq(a,b,n)
Equivalent to (*(a)==*(b)&&strncmp(a,b,n)==0).
π₯ FUNCTIONS π₯
π¦ void astwinsize(int fd, int* plines, int* pcolumns)
If plines!=0 then *plines is set to the number of lines on the tty device corresponding to fd. If pcolumns!=0 then *pcolumns is set to the number of columns on the tty device corresponding to fd. The default if fd is not a terminal device, or if fd queries fail, is 24 lines and 80 columns. π
π¦ char* fmterror(int errno)
Returns the error message text corresponding to the errno(3) errno.
π¦ char* strerror(int errno)
Equivalent to fmterror(errno).
π¦ int strgrpmatch(const char* string, const char* pattern, int* sub, int nsub, int flags)
Matches the null terminated string against the null terminated ksh(1) augmented pattern. If sub!=0 then sub[2*i] is set to the start offset and sub[2*i+1] is set to the end offset of the i-th parenthesized subexpression. nsub is 1/2 the number of elements in sub. flags controls the matching:
STR_MAXIMALβ Maximal match. The default is minimal (first) match.STR_LEFTβ Implicit left anchor.STR_RIGHTβ Implicit right anchor.STR_ICASEβ Ignore case.STR_GROUPβ(|&)inside[@|*|+{n,m}](...)only.
π¦ int strmatch(const char* string, const char* pattern, int* sub, int nsub, int flags)
Equivalent to strgrpmatch(string,pattern,0,0,STR_MAXIMAL|STR_LEFT|STR_RIGHT).
π SEE ALSO π
ast(3), ccode(3), cdt(3), error(3), malloc(3), option(3), sfio(3), stk(3)
Thatβs the whole ASTSA(3) page from the Library Functions Manual, bestie β source/version stamp: ASTSA(3), and the date line isnβt printed in this copy, so no invented date, fr fr. Stay iconic, keep your macros close, and may all your boundaries be powers of 2. π
πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms