~donmcc/astr

f2a072138b8ee175413f69866fbd8ab5b4d9a400 — Don McCaughey 1 year, 9 months ago df9a86a
Added man page and updated the readme.

Added "Overview" and "Functions" section to the readme.
3 files changed, 69 insertions(+), 6 deletions(-)

M Makefile.am
M README.md
A astr.3
M Makefile.am => Makefile.am +1 -0
@@ 9,5 9,6 @@ LDDADD = $(lib_LIBRARIES)
check_PROGRAMS = astr_tests
TESTS = $(check_PROGRAMS)

dist_man3_MANS = astr.3
EXTRA_DIST = LICENSE README.md


M README.md => README.md +21 -6
@@ 4,12 4,27 @@ A C99 library for working with dynamically allocated strings.

[![builds.sr.ht status](https://builds.sr.ht/~donmcc/astr.svg)](https://builds.sr.ht/~donmcc/astr?)

## 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()`][1] on the returned pointer.

[1]: http://man7.org/linux/man-pages/man3/free.3.html

## Functions

    char *
    astr_alloc_empty(void);

Allocate an empty string.

## Dependencies
`astr` requires that `<stdio.h>` defines the [`vasprintf()`][1] function.
Building from repository source requires [GNU Autotools][2].
`astr` requires that `<stdio.h>` defines the [`vasprintf()`][2] function.
Building from repository source requires [GNU Autotools][3].

[1]: http://man7.org/linux/man-pages/man3/asprintf.3.html
[2]: https://www.gnu.org/software/automake/faq/autotools-faq.html
[2]: http://man7.org/linux/man-pages/man3/asprintf.3.html
[3]: https://www.gnu.org/software/automake/faq/autotools-faq.html

## Building from Repository Source



@@ 22,8 37,8 @@ Clone the repository then generate the `configure` script, configure and build.
    ../configure && make && sudo make install

## License
`astr` is made available under a BSD-style license; see the [LICENSE][3] file
`astr` is made available under a BSD-style license; see the [LICENSE][4] file
for details.

[3]: https://git.sr.ht/~donmcc/astr/tree/master/LICENSE
[4]: https://git.sr.ht/~donmcc/astr/tree/master/LICENSE


A astr.3 => astr.3 +47 -0
@@ 0,0 1,47 @@
.\" Modified from man(1) of FreeBSD, the NetBSD mdoc.template and mdoc.samples
.\" See man mdoc for the short list of editing options
.Dd February 22, 2020
.Dt ASTR 3
.Os
.Sh NAME
.Nm astr_alloc_empty
.Nd functions for working with dynamically allocated strings.
.Sh SYNOPSIS
.In astr.h
.Ft char *
.Fn astr_alloc_empty "void"
.Sh DESCRIPTION
The
.Nm astr
library provides functions for working with dynamically allocated strings,
building on top of
.Fn vasprintf .
.Pp
All functions in
.Nm astr
begin with the
.Sy astr_
prefix.
Functions that return newly allocated strings will contain
.Sy alloc_
in their name; the caller is responsible for calling
.Fn free
on the returned pointer.
.Pp
.Fn astr_alloc_empty
allocates an empty string.
.Sh RETURN VALUES
On success,
.Fn astr_alloc_empty
returns a pointer to a zero-length string.
If there is an error, a
.Dv NULL
pointer is returned and
.Va errno
is set to
.Er ENOMEM .
.Sh SEE ALSO
.Xr free 3 ,
.Xr vasprintf 3
.Sh AUTHORS
.An Don McCaughey