RC_STRLIST(3)
π RC_STRLIST π
okay bestie, so this is RC_STRLIST(3) from the System Manager's Manual β it's the string list page and it's lowkey the backbone of like everything in OpenRC, no cap. let's get into it π«Ά
β¨ NAME β¨
rc_stringlist_add, rc_stringlist_addu, rc_stringlist_delete, rc_stringlist_free, rc_stringlist_new, rc_stringlist_sort β the RC string list functions. that's the whole squad, they ride together π
π LIBRARY π
Run Command library (librc, -lrc)
like. that's the library. that's it. link it and you're in π
πΈ SYNOPSIS πΈ
#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);
copy it exactly bestie, don't freestyle the signatures, i'm begging π
π¦ DESCRIPTION π¦
so these functions are your little helpers for wrangling string lists. and when i say little helpers, i mean they're basically wrappers around the TAILQ macros from queue(3). iconic behavior honestly β why reinvent the wheel when the wheel is already slaying π
Here's the whole roster, one by one:
rc_stringlist_new()β makes you a brand new list head to store the list in. it's giving fresh start, main character energy β¨rc_stringlist_add()β adds a malloced copy of item to list. returns a pointer to the new item when it goes well, orNULLif it doesn't, and setserrnoaccordingly. so like, check your return values, bestie, please πrc_stringlist_addu()β same vibe as above but it only works if list does not already contain item. it's the picky one. it's got standards. we respect it.rc_stringlist_delete()β removes and frees item from list, returningtrueon success, otherwisefalse. cute and destructive πrc_stringlist_sort()β sorts the list according to C locale. not your locale, not your friend's locale, the C one. periodt.rc_stringlist_free()β frees every single item on list and then the list itself. it's the closer. it takes everything with it. no survivors π«Ά
π SEE ALSO π
malloc(3), free(3), queue(3), strcmp(3)
go read those too, iykyk π
π AUTHORS π
Roy Marples <roy@marples.name> β the legend themselves, we love and appreciate π₯°
okay that's the page!! this one came out of the OpenRC crew and it's dated Mar 16, 2008 β yes it's old, it's vintage, it's still serving π go sort some strings bestie, you got this πβ
π¦ where this page comes from
- alpine 3.22: openrc-doc 0.62.6-r0 Β· BSD-2-Clause
- alpine 3.23: openrc-doc 0.63-r1 Β· BSD-2-Clause
- alpine 3.24: openrc-doc 0.63.2-r0 Β· BSD-2-Clause
- debian bookworm: librc-dev 0.45.2-2+deb12u1 Β· BSD-2-clauses
- debian trixie: librc-dev 0.56-1 Β· BSD-2-clauses
- Copyright (c) 2007-2015 The OpenRC Authors
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms