fmt_ip6c(3)
π fmt_ip6c β the IPv6 glow-up formatter π
okay bestie, welcome to fmt_ip6c(3) from the Library Functions Manual. she takes a raw IPv6 number and turns it into a cute little ASCII string. it's giving translator, it's giving main character. let's go β¨
πΈ NAME πΈ
fmt_ip6c β write a formatted ASCII representation of an IPv6 number
π SYNTAX π
#include <libowfat/ip6.h>
unsigned int fmt_ip6c(char *dest,const char ip[16]);
β¨ DESCRIPTION β¨
so basically fmt_ip6c takes an IPv6 number from ip, formats it in ASCII representation, and writes the result into dest. it returns the number of bytes written. no cap. π
fmt_ip6c will apply "::" compression to the output. yes queen, she's compact.
if ip is an IPv4-mapped IPv6 address, fmt_ip6c will output it as an IPv4 address. she switches lanes when the vibe calls for it π¦
if dest equals FMT_LEN (i.e. is zero), fmt_ip6c returns the number of bytes it would have written. a hypothetical slay. π₯
β οΈ real talk:fmt_ip6cdoes not append\0. she is NOT going to null-terminate your string for you, bestie. that's on you, periodt.
for convenience, ip6.h defines the integer IP6_FMT to be big enough to contain every possible fmt_ip6c output plus \0. so use that buffer size and you're safe π«Ά
π EXAMPLE π
#include <libowfat/ip6.h>
char buf[IP6_FMT];
char ip[16];
buf[fmt_ip6c(buf,ip)]=0;
see how we manually slap that 0 on the end? yeah. because no \0, remember? π
π SEE ALSO π
and that's the whole page, angel π this was fmt_ip6c(3) from the Library Functions Manual β go forth and format your IPv6 addresses with "::" compression and zero null terminators, iykyk. mwah πβ¨
π¦ 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