HESIOD(3)

πŸ’– HESIOD(3) πŸ’–

okay bestie, welcome to the Library Functions Manual era, we're doing Hesiod today and honestly? it's giving vintage but make it useful. ✨


🌸 NAME 🌸

hesiod_getmailhost, hesiod_free_postoffice β€” Hesiod functions for retrieving user to postoffice mappings 🫢


✨ SYNOPSIS ✨

#include <hesiod.h>

struct hesiod_postoffice *hesiod_getmailhost(void *context,
     const char *user)
void hesiod_free_postoffice(void *context,
     struct hesiod_postoffice *po)

cc file.c -lhesiod

πŸ¦‹ DESCRIPTION πŸ¦‹

so this whole little family of functions lets you pull user β†’ postoffice mappings using Hesiod. iconic behavior, no cap. πŸ’…

but before you can do literally any lookups, you need an initialized Hesiod context β€” go read hesiod(3) for the deets on that, i'm not gatekeeping but that's a different page, bestie. 🌈

the info comes back to you inside a hesiod_postoffice structure, and it has these fields:

  • hesiod_po_type β€” the type of postoffice box, typically ``POP''. it's giving very specific. πŸŽ€
  • hesiod_po_host β€” the hostname where the postoffice box resides. that's its home, its main character address. πŸ‘‘
  • hesiod_po_name β€” the account name on the given postoffice server.
⚠️ and this part is on you, fr fr: it is the caller's responsibility to call hesiod_free_postoffice with the returned postoffice entry to free the resources used by the postoffice entry. don't just walk away from it, that's rude and also a memory leak. 😭

so how does the actual lookup work? Hesiod queries for postoffice information are made using the ``pobox'' Hesiod type, using the username as the Hesiod name. and the corresponding entries should be space-separated lists of strings giving:

  1. the type of postoffice box
  2. the hostname
  3. the account name

three little strings, one slay little list. ⭐


πŸŽ€ RETURN VALUES πŸŽ€

on failure, hesiod_getservbyname returns NULL and sets the global variable errno to indicate the error. (yes, that's the name the page says β€” i'm not editing the lore, i'm just reporting it. πŸ™ˆ)


πŸ’€ ERRORS πŸ’€

hesiod_getmailhost may fail for any of the reasons the routine hesiod_resolve may fail. that's it, that's the whole tea β€” go check hesiod_resolve if you want the receipts. πŸ”₯


🧚 SEE ALSO 🧚


and that's the page, bestie!! this cutie dropped on 30 November 1996 as part of the HESIOD(3) library functions manual energy β€” vintage queen behavior, we respect her. πŸ’œβœ¨πŸŽ€