scan_ip6_flat(3)
π scan_ip6_flat β it's in the NAME section bestie π
okay so real quick, this whole page is scan_ip6_flat(3) from the Library Functions Manual, and she's here to parse an IPv6 number in flat ASCII representation. yes ma'am. π
β¨ SYNTAX β¨
like, the whole vibe starts with this include:
#include <libowfat/ip6.h>
int scan_ip6_flat(const char *src,char ip[16]);
that's it. that's the whole signature. she's small but she's mighty. π
πΈ DESCRIPTION πΈ
so scan_ip6_flat does the thing where it parses an IPv6 number in flat ASCII representation β reading it out of src β and then writes the result into ip. π¦
and then she tells you how it went: she returns the number of bytes read from src, or 0 if the parsing failed. that's the whole status report, no cap.
she's also super chill about letter case β scan_ip6_flat accepts upper AND lower case hex letters. equal opportunity hex. periodt. π
one little note tho: the flat representation you feed her should have been output by fmt_ip6_flat. they're a matched set, an iconic duo, iykyk. π«Ά
β EXAMPLE β
here's the moment you've been waiting for, the code:
#include <libowfat/str.h>
#include <libowfat/ip6.h>
char buf[]="00000000000000000000000000000001";
char ip[16];
if (scan_ip6_flat(buf,ip) != str_len(buf))
parse_error();
see how she checks that the return value equals str_len(buf)? if it doesn't, parse_error(). not me being obsessive about checking the return value, it's giving responsible. πβ¨
π₯ SEE ALSO π₯
fmt_ip6_flat(3)β her other half πscan_ip6(3)β cousin energy π
okay that's the whole page bestie, no notes. this was scan_ip6_flat(3) straight outta the <strong>Library Functions Manual</strong>, so go forth and parse those flat IPv6 numbers. 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