libstrl

DESCRIPTION:

Implementations of various functions which are absent from an
intersection of the BSD and GNU libcs. This most notably includes
strlcat(), strlcpy(), strnlen(), wcslcat(), wcslcpy(), and wcsnlen();
however, there are a growing number of replacement
implementations. This library will make sure that each of these
functions is available to the program which uses it.

BSD systems have strl* and wcsl*, GNU systems have strnlen() and
wcsnlen(). However, certain BSDs don't have strnlen() or wcsnlen() and
GNU doesn't have strl* or wcsl*. For this reason, developers who are
caught up in the strl* philosophy or find strnlen()/wcsnlen() useful
often end up bundling a copy of such a function with their packages.

There are other ways to get implementations of such functions. For
example, a program using glib would want to use g_strlcpy() and
g_strlcat() (which is quite integrated into the typedefs which glib
uses). If you can find other examples which should be placed here,
please tell binki about them ;-).

This library is created in a sort of opposition to the gnulib and CCAN
( http://ccan.ozlabs.org/ ). gnulib provides implementations of many
functions available only in GNU libc. CCAN, intending to be like CPAN,
encourages copying and even wrangling of potentially reusable
sourcecode. gnulib likewise distributes its functions at the source
level, meaning that every program which uses a gnulib function will
bundle and compile a copy of that function. With libstrl, such a
program would instead just link against libstrl (statically or
dynamically). This way, the code needn't be duplicated into every
package which needs that function. This ideally means that a developer
using one of the functions which libstrl implements does less work to
ensure that his program compiles and runs successfully on both BSD and
GNU systems.

USAGE:

To use this library, get compilation flags from pkg-config:
$ pkg-config libstrl --cflags
Also get linker flags:
$ pkg-config libstrl --libs
In your source, be sure to include strl.h:
#include <strl.h>

In configure.ac, you may use:
PKG_CHECK_MODULES([LIBSTRL], [libstrl >= 0.2])
LIBS="$LIBS $LIBSTRL_LIBS"
CFLAGS="$CFLAGS $LIBSTRL_CFLAGS"

You should look into the HISTORY file or see the Doxygen-generated
HTML documentation to find out which versions of libstrl various
functions were added.

Warning: release 0.1 of libstrl was a complete failure, its strlcat()
and wcslcat() functions returned invalid values when clipping
happened. However, no systems ever had libstrl-0.1 installed so there
should be no copies of 0.1 in the wild ;-).

SUPPORT:

Please report bugs at https://ohnopub.net/bugzilla . Yes, sorry, this
is another account. Or, reach binki or apostrophe on freenode (
irc://irc.freenode.net/libstrl ) , OFTC, or efnet or poke him on
irc://irc.ohnopub.net/protofusion .

SOURCE CODE:

The VCS is Mercurial, use
$ hg clone http://hg.ohnopub.net/hg/libstrl
to get the development source.

Tarballs are listed at http://ohnopub.net/~ohnobinki/libstrl .
