dns_mx(3)
π dns_mx(3) β the Library Functions Manual girlies know π
okay so bestie, we're in the Library Functions Manual and this page is literally called dns_mx(3). it's giving DNS detective energy and i'm obsessed. let's get into it β¨
πΈ NAME πΈ
dns_mx β look up Mail eXchanger π¦
π SYNTAX π
#include <libowfat/dns.h>
int dns_mx(stralloc* out,stralloc* fqdn);
π DESCRIPTION π
okay so dns_mx looks up MX records for the fully-qualified domain name sitting in fqdn. yes, the whole fqdn, don't be shy about it.
it drops the MX records into out and returns 0. and what does each MX record look like, you ask? periodt, i'll tell you:
- a two-byte MX distance (big endian, no cap), followed by
- a
\0-terminated dot-encoded domain name
so each record is literally a little sandwich: distance first, name second. iconic.
if the domain doesn't exist in DNS, or it exists but has no MX records, then out will be empty. that's it. that's the vibe. π
β οΈ and now the part we do NOT gloss over: ifdns_mxhas trouble with the DNS lookup, or it runs out of memory, it returns-1and setserrnoappropriately. it may or may not changeout. yes bestie, MAY OR MAY NOT. so don't go trustingoutafter a-1, fr fr. π
π₯ SEE ALSO π₯
go read those next, i promise they slay too π«Ά
π cute little sign-off π
and that's the page!! it signs itself off as dns_mx(3) in the Library Functions Manual β no extra source, no version, no date, just the name and the manual, which is honestly main character energy. anyway bestie, go resolve some mail exchangers, you're gonna eat π
β¨π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms