Libmib Allocated String Functions

Background - Usage - Issues - Example Uses - Get the source

Libmib astrings implement a fast, efficient "limitless" string. Use astrings in place of fixed length string buffers, which are a common area of software defects causing operational or security failure.

Libmib Design for Reuse
Goals of the astring memory management subroutines
C and C++ sources which #include "libmib/astring.h" can

    char *astrcpy(char **ppasz,const char *pSrc);
    char *astrn0cpy(char **ppasz,const char *pSrc,int n);
	/* NOTE: astrn0cpy Always stores the ending \0 */
    int avsprintf(char **ppasz, const char *format,va_list ap);
    int asprintf(char **ppasz, const char *format,...);
    char *afgets(char **ppasz,FILE *f);
    int afgettoch(char **ppasz,FILE *f, char chStop)
	/* Reads up to and including the next chStop character,
	   storing a \0 afterwards.  Returns number of characters read. */
Details, important reminders, and examples are available at libmib astring usage.

More Detailed Topics
String handling Comparison illustrates a number of common ways (some safe, some not) of handling strings in C. libmib astring functions make safe string handling simple.

libmib astring usage
There are just a few simple points to remember when creating, using, and destroying astrings.

astring advanced usage
Using astrensure() to write your own limitless string functions.

Example: an "fgrep-like" filter using astrings easily handles unlimited line lengths in a small amount of code.

Get the Source
Terms of Use: Free for commercial and non-commercial use under the libmib license

In your script, use
    httpsync @
to synchronize to the following packing list. (NOTE: These files #include <libmib/local.h>, which can be created as an empty file when no local libmib configurations are necessary.)

#-#httpsync 101 Packing List for httpsync 1.01-1.02
# Visit the httpsync home page:
./libmib/astring.h 5923 Mon, 14 Dec 1998 21:18:28 GMT 644
./libmib/compat.h 7327 Thu, 06 Jan 2000 15:38:46 GMT 644
./parse/astring.c 18901 Wed, 15 Dec 1999 14:40:36 GMT 644
./parse/asprintf.c 16808 Tue, 22 Dec 1998 21:34:28 GMT 644

Overview and Related Topics
Up to: Libmib: Character String Processing
Up to: Libmib

This Libmib documentation may not be distributed. Copyright 1998, Forrest J. Cavalier III
Mib Software
High Reuse Software Development