IXP_PSTRINGS(3)

πŸ“¦ version 0-unstable-2022-04, in nixos 26.05, nixpkgs unstable

πŸ’– IXP_PSTRINGS(3) πŸ’–

okay so bestie, this page comes from the Library Functions Manual, and it's all about ixp_pstrings β€” the pack/unpack girlie for arrays of UTF-8 strings. slay. 🫢


πŸŽ€ NAME πŸŽ€

ixp_pstrings


✨ SYNOPSIS ✨

#include <ixp.h>

void ixp_pstrings(IxpMsg *msg, uint16_t *num, char *strings[], uint max);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: ixp_pstrings packs or unpacks an array of UTF-8 encoded strings. no cap. πŸ’…

The packed representation consists of a 16-bit element count followed by an array of strings as packed by ixp_pstring(3). The unpacked representation is an array of nul-terminated character arrays. iconic behavior honestly. ✨

🫢 the mode check, iykyk 🫢

  • msg->mode is MsgPack β€” the *num strings in the array pointed to by strings are packed into the buffer at msg->pos. πŸ”₯
  • msg->mode is MsgUnpack β€” *num is loaded with the number of strings unpacked, the array at *strings is loaded with pointers to the unpacked strings, and (*strings)[0] must be freed by the user. πŸ’€ yes bestie, you have to free it.

In either case, msg->pos is advanced by the number of bytes read or written. periodt. πŸ’…

⚠️ boundary tea: if the action would advance msg->pos beyond msg->end, msg->pos is still advanced, but no other action is taken. don't act surprised. πŸ™ˆ
🌈 another limit, bestie: if *num is greater than max, msg->pos is set beyond msg->end and no other action is taken. that's the whole rule. 🫢

🌟 SEE ALSO 🌟

go give these their flowers: IxpMsg, ixp_pstring, ixp_pdata πŸŽ€


with love from the libixp Manual, dated 2012 Dec β€” mwah, bestie πŸ’‹πŸ‘‘

πŸ“¦ where this page comes from