~donmcc/astr

ref: f4dd4ca4751396f256f3b9dd6c65c265c1a33ef1 astr/README.md -rw-r--r-- 1.6 KiB
f4dd4ca4Don McCaughey Change "formatted" to "format". 1 year, 10 months ago

#astr

A C99 library for working with dynamically allocated strings.

builds.sr.ht status

#Overview

All functions in astr begin with the astr_ prefix. Functions that return newly allocated strings will contain alloc_ in their names; the caller is responsible for calling free() on the returned pointer.

#Functions

char *
astr_alloc_empty(void);

Allocate an empty string.

char *
astr_alloc_format(char const *format, ...);

Allocate a formatted string.

char *
astr_alloc_format_args(char const *format, va_list arguments);

Allocate a formatted string using a va_list object.

bool
astr_eq_bytes(char const *s1, char const *s2);

Compare the bytes of two strings for equality; s1 and s2 may be NULL.

#Dependencies

astr requires that <stdio.h> defines the vasprintf() function. Building from repository source requires GNU Autotools.

#Building from Repository Source

Clone the repository then generate the configure script, configure and build.

git clone https://git.sr.ht/~donmcc/astr
cd astr
autoreconf -i
mkdir tmp && cd tmp
../configure && make && sudo make install

#License

astr is made available under a BSD-style license; see the LICENSE file for details.