DOKK / manpages / debian 10 / librc-dev / rc_stringlist_new.3.en
RC_STRLIST(3) Library Functions Manual (smm) RC_STRLIST(3)

rc_stringlist_add, rc_stringlist_addu, rc_stringlist_delete, rc_stringlist_free, rc_stringlist_new, rc_stringlist_sortRC string list functions

Run Command library (librc, -lrc)

#include <rc.h>

RC_STRINGLIST *
rc_stringlist_new(void);

RC_STRING *
rc_stringlist_add(RC_STRINGLIST *list, const char *item);

RC_STRING *
rc_stringlist_addu(RC_STRINGLIST *list, const char *item);

bool
rc_stringlist_delete(RC_STRINGLIST, const char *item);

void
rc_stringlist_free(RC_STRINGLIST *list);

void
rc_stringlist_sort(RC_STRINGLIST *list);

These functions provide an easy means of manipulating string lists. They are basically wrappers around TAILQ macros found in queue(3).

() creates a new list head to store the list.

() adds a malloced copy of item to list. It returns a pointer to the new item on success, or NULL on failure and sets errno accordingly. () only works if list does not already contain item.

() removes and frees item from list, retuning true on success, otherwise false.

() sorts the list according to C locale.

() frees each item on list and the list itself.

malloc(3), free(3), queue(3), strcmp(3)

Roy Marples <roy@marples.name>

March 16, 2008 OpenRC