RC_CONFIG(3)

πŸ“¦
version 0.63.2 Β· 2 versions
, in alpine 3.22, alpine 3.23, alpine 3.24

πŸ’… RC_CONFIG(3) β€” the OpenRC config-querying girlies πŸŽ€

okay so bestie, welcome to the Run Command library β€” that's librc, and you link it with -lrc. This page is all about the little functions that let you peek at OpenRC service config files without losing your mind. Let's get into it ✨


✨ NAME ✨

rc_config_list, rc_config_load, rc_config_value, rc_yesno β€” the functions that query OpenRC service configurations. That's the whole squad 🫢


✨ SYNOPSIS ✨

#include <rc.h>

RC_STRINGLIST *
rc_config_list(const char *file);

RC_STRINGLIST *
rc_config_load(const char *file);

char *
rc_config_value(const char *const *list, const char *entry);

bool
rc_yesno(const char *value);

like, look at them. iconic signatures. no notes πŸ’…


✨ DESCRIPTION ✨

These functions are your easy lil shortcut to querying OpenRC configuration files, fr fr. No cap, they make it so much easier than doing it all by hand.

  • rc_config_list() β€” returns a list of the non-comment lines in file. Just the good stuff, no #-noise 🌸
  • rc_config_load() β€” does the exact same thing, but it also attempts to parse the line as if it was a shell assignment. highkey the glow-up version ✨
  • rc_config_value() β€” returns the value of entry found in list. like, you give it the list, you give it the key, it gives you the value. slay πŸ”₯
bestie listen β€” each list should be freed using rc_stringlist_free() when you're done with it. don't be out here leaking memory, that's not the vibe 😭
  • rc_yesno() β€” returns true if value is "true", "yes", "y" or "1", regardless of case. Otherwise, if value is "false", "no", "n" or "0" (regardless of case), it returns false. And if value doesn't match either one? Then it returns false and sets errno to EINVAL. so yeah, it's giving "no means no, but also invalid means no" πŸ’€

✨ SEE ALSO ✨

malloc(3), rc_stringlist_free(3), sh(1) β€” go read those too, iykyk πŸ¦‹


✨ AUTHORS ✨

Roy Marples <roy@marples.name> β€” the main character who made this happen πŸ‘‘


and that's the page bestie!! this one's from the OpenRC manual, dated Mar 17, 2008. periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from