MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
STRINGLIST(3)            BSD Library Functions Manual            STRINGLIST(3)

NAME
     stringlist, slinit, sladd, slfree, slfind -- stringlist manipulation
     functions

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     ##include <>

     StringList *
     slinit();

     int
     sladd(StringList *sl, char *item);

     void
     slfree(StringList *sl, int freeall);

     char *
     slfind(StringList *sl, char *item);

DESCRIPTION
     The stringlist functions manipulate stringlists, which are lists of
     strings that extend automatically if necessary.

     The StringList structure has the following definition:

           typedef struct stringlist {
                   char    **slstr;
                   sizet    slmax;
                   sizet    slcur;
           } StringList;

           slstr  a pointer to the base of the array containing the list.

           slmax  the size of slstr.

           slcur  the offset in slstr of the current element.

     The following stringlist manipulation functions are available:

     slinit()  Create a stringlist.  Returns a pointer to a StringList, or
                NUL in case of failure.

     slfree()  Releases memory occupied by sl and the sl->slstr array.  If
                freeall is non-zero, then each of the items within sl->slstr
                is released as well.

     sladd()   Add item to sl->slstr at sl->slcur, extending the size of
                sl->slstr.  Returns zero upon success, -1 upon failure.

     slfind()  Find item in sl, returning NUL if it's not found.

SEE ALSO
     free(3), malloc(3)

HISTORY
     The stringlist functions appeared in FreeBSD 2.2.6 and NetBSD 1.3.

BSD                            November 28, 1999                           BSD
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™