dns_ip4(3)
π dns_ip4 β look up IPv4 addresses π
okay bestie, welcome to dns_ip4(3) from the Library Functions Manual, this is the one that gets you those sweet sweet 4-byte IP addresses π¦
β¨ NAME β¨
dns_ip4 β look up IPv4 addresses. that's it. that's the vibe. π
πΈ SYNTAX πΈ
#include <libowfat/dns.h>
int dns_ip4(stralloc* out,stralloc* fqdn);
two stralloc*s, one int, no drama. π
π DESCRIPTION π
so like. dns_ip4 looks up the 4-byte IP addresses for the fully-qualified domain name sitting in fqdn. it takes the concatenation of those IP addresses, drops them into out, and returns 0. iconic behavior, no notes. β¨
and if the domain doesn't exist in DNS, or it exists but has no IP addresses? then out will be empty. like, ghosted. π
now for the part where it gets real. if dns_ip4 has trouble with the DNS lookup, or if it runs out of memory, it returns -1 and sets errno appropriately. also β heads up β it may or may not change out. so don't go trusting out after a -1, bestie, that's not a safe place to be. π
but wait, here's the fun shortcut π: if fqdn is already a dotted-decimal IP address, dns_ip4 just puts that IP address into out without checking DNS. why ask the internet when you already know the answer, right?
and more generally β yes, it gets more general, she contains multitudes β if fqdn is a dot-separated sequence of dotted-decimal IP addresses, dns_ip4 puts those IP addresses into out without checking DNS too. multi-IP slay. π
also, brackets may appear inside the dotted-decimal IP addresses, and they are ignored. they're just there for decoration i guess, we don't question them. π
ngl, the "may or may not change out" thing is the one to remember. that's the lore. π«Ά
π SEE ALSO π
and that's the whole page, bestie π this was dns_ip4(3), living in the Library Functions Manual, and yes she's still called dns_ip4(3) on the way out too β she said her name twice because she's that girl. π periodt. ππ¦β¨
π¦ 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