fmt_ip6if(3)
β¨ NAME β¨
fmt_ip6if β bestie, this one writes you a formatted ASCII representation of an IPv6 number π
πΈ SYNTAX πΈ
#include <libowfat/ip6.h>
unsigned int fmt_ip6if(char *dest,const char ip[16],uint32 scope_id);
π DESCRIPTION π
okay so fmt_ip6if takes an IPv6 number from ip, formats it all pretty in ASCII, and drops the result into dest. It hands you back the number of bytes it wrote. cute, right? π
It will apply "::" compression to the output β no cap, that's the whole point, it keeps things short and iconic β¨
If ip is an IPv4-mapped IPv6 address, fmt_ip6if will output the last 4 bytes as an IPv4 number in dotted-decimal notation. slay π
If dest equals FMT_LEN (i.e. is zero), fmt_ip6if returns the number of bytes it would have written. lowkey a vibe check for sizing π¦
π«Ά heads up:fmt_ip6does not append\0.
ip6.h defines the integer IP6_FMT to be big enough to contain every possible fmt_ip6 output plus \0. However, for fmt_ip6if you need to add 1 for the '%' and IF_NAMESIZE from <net/if.h> for the interface name. literally do not forget this part, bestie, or your buffer is gonna be giving π
π¦ EXAMPLE π¦
#include <libowfat/ip6.h>
char buf[IP6_FMT];
char ip[16];
scope_id sid;
buf[fmt_ip6if(buf,ip,sid)]=0;
π SEE ALSO π
and that's the whole page, bestie π this one came straight out of the Library Functions Manual β fmt_ip6if(3) β so go forth and format those IPv6 numbers, 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