qlibs:(ipv4)
π NAME π
okay bestie, welcome to the qlibs:(ipv4) manual page β¨ β this one is all about IPv4 address evaluation and conversion, and honestly it's giving very useful little toolkit energy π
ipv4 β IPv4 address evaluation and conversion
π§ SYNTAX π§
#include "ip.h"
unsigned int ip4_fmt(char *s,char ip[4]);
unsigned int ip4_scan(const char *s,char ip[4]);
unsigned int ip4_scanbracket(char *s,char ip[4]);
unsigned int ip_scanbracket(char *ip_str,char *s);
unsigned int ip4_cidr(char *s,char ip[4],unsigned long *plen);
unsigned int ip4_bytestring(stralloc *ip4string,char ip[4],int plen);
π¦ DESCRIPTION π¦
okay so here's the vibe check on every function, bestie π
ip4_fmtβ reads thechar[4]IPv4 address and returns a dotted-decimal IPv4 address string1.2.3.4. literally the glow-up from packed bytes to pretty dotted-decimal πip4_scanβ reads an IPv4 address string1.2.3.4and converts it to thechar[4]IPv4 address. yes ma'am, string in, packed address out π«Άip4_scanbracketβ reads an IPv4 address string enclosed in brackets[1.2.3.4], removes the brackets, and callsip4_scanon the result. bracket removal is the main character here πip_scanbracketβ reads an IP address string enclosed in brackets[1.2.3.4]or[fe80::1], removes the brackets, and callsip4_scanorip6_scanupon detecting an IPv6 address on the result. so it's flexible like that β¨ip4_cidrβ reads the CIDR IPv4 address string1.2.3.4/15, determines the prefix as integerplen, and callsip4_scan. If no prefix is identified, it returns32. periodt πip4_bytestringβ reads the IPv4 address given aschar[4]while returning a 0-terminated 'bytestring' representation1001001....up to the given prefix lengthplen. it's giving binary reveal, no cap π¦
π RETURN CODES π
The ip(4)* programs return the number of bytes processed.
ip4_bytestring returns regative numbers on failure.
bestie, yes β the page literally says regative, and I'm not out here editing the original lore ππ
π SEE ALSO π
xoxo, signing off from your qlibs:(ipv4) corner of the manual π β source/version tag at the bottom was qlibs:(ipv4), and the original footer didn't give a separate date, so I'm not inventing one, periodt π«Άβ¨
π¦ where this page comes from
- alpine 3.24: fehqlibs-doc 31-r0 Β· Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms