GENDERS_ERRNUM(3)

✨ GENDERS_ERRNUM ✨

okay bestie, welcome to the libgenders error-handling corner of the universe πŸ’– this is the <genders.h> trio-plus-one that tells you what went wrong when your genders calls go sideways. no cap, every C program needs a bestie who will just tell them the truth about their errors, and that's these four functions: genders_errnum, genders_strerror, genders_errormsg, genders_perror. it's giving emotional support for your error codes. 🫢


🌸 SYNOPSIS 🌸

#include <genders.h>

int genders_errnum(genders_t handle);

char *genders_strerror(int errnum);

char *genders_errormsg(genders_t handle);

void genders_perror(genders_t handle, const char *msg);

πŸ’… DESCRIPTION πŸ’…

so here's the tea, one function at a time πŸ“

  • genders_errnum() β€” hands you back the error code that's been sitting inside handle. that's it. that's the whole job. queen of just telling you the number. πŸ‘‘
  • genders_strerror() β€” gives you a pointer to a string that describes the error code errnum. so you bring the number, it brings the words. slay.

okay and lowkey the classic move is: you grab an error code with genders_errnum() and then you pass it straight into genders_strerror(). that's the combo, that's the duo, that's the main character team-up. ✨

  • genders_errormsg() β€” returns a pointer to a string describing the error that's chillin' inside handle. and the way that it works is logically equivalent to this:
char *genders_strerror(genders_errnum(genders_t handle));

so it's literally the two functions above but fused together like a friendship bracelet. πŸŽ€

  • genders_perror() β€” this one is similar to perror(3). it prints a message to standard error output describing the error stored in handle. and here's the detail that matters, bestie: if msg is not NULL, then the string pointed to by msg, a colon, and a blank are printed before the error message. if msg is NULL, you don't get that little prefix. no prefix, no problem. πŸ’…
ngl the msg-not-NULL thing is the whole personality of genders_perror(). don't forget the colon and the blank, it's not just the colon, it's colon plus blank. periodt. πŸŽ€

πŸ¦‹ FILES πŸ¦‹

  • /usr/include/genders.h

and that's the whole page, babe 🌈 remember: grab the number with genders_errnum(), turn it into words with genders_strerror(), or let genders_errormsg() and genders_perror() do the translating for you. iconic behavior only. πŸ’œ

this whole vibe comes to you from LLNL, dated August 2003, living in the LIBGENDERS manual β€” so yeah, this energy has been serving error messages since way before any of us were cool. mwah. πŸ’…βœ¨