cl_hp_parse_field(3)

πŸ’… cl_hp_parse_field β€” the libcanlock-hp one, from the canlock-hp 3.3.2 manual ✨

okay bestie, sit down, we're doing the cl_hp_parse_field(3) page and honestly it's giving "small but mighty" πŸŽ€


🌸 NAME 🌸

cl_hp_parse_field β€” this one literally just runs the field parser for you, no cap 🫢


✨ SYNOPSIS ✨

#include <libcanlock-3/canlock-hp.h>

char *cl_hp_parse_field(const char *data, size_t data_len);

look at her. two params. flawless. πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so the way that cl_hp_parse_field() works is: it executes the header field parser. that's the whole vibe fr fr.

and here's the tea β€” this implementation runs the canlock-hfp utility in a separate process. like, she outsources. iconic behaviour honestly πŸ’…

  • data β€” this parameter should point to the beginning of the input data. right at the start, bestie, no skipping ahead πŸ¦‹
  • data_len β€” and you specify the length of the input data here. that's it, that's the param ✨

now the important bit, pay attention πŸ‘€ the input data must be an unfolded "Cancel-Lock" or "Cancel-Key" header field, without a line break at the end. like, unfolded. no trailing newline. that's the rule and we respect it πŸ™

and if your data isn't already in that state, the lib's got your back:

  • cl_hp_get_field() β€” use this to extract a field from the message header πŸŽ€
  • cl_hp_unfold_field() β€” use this to remove potential folding from an already extracted header field 🌈

chain them together, it's a whole little pipeline, she ate πŸ’…


πŸ”₯ RETURN VALUE πŸ”₯

if the parser reports success, you get a pointer to the NUL-terminated output data. success = pointer, we love that for you πŸ’œ

otherwise? NULL. that's it. no in-between. it's giving binary. πŸ’€

⚠️ okay important warning bestie: on success, the caller is responsible to free() the memory block allocated for the output data. the memory is yours now. don't ghost it. free it. fr fr 😭

πŸ‘‘ AUTHORS πŸ‘‘

Michael Baeuerle β€” the main character who wrote this 🫢


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? report it to <mailto:michael.baeuerle@gmx.net>. don't be shy, they want to know 🌸


🧚 STANDARDS 🧚

cl_hp_parse_field() tries to comply with the following standards:

(tries to. we love an honest queen πŸ’…)


⭐ SEE ALSO ⭐

go read them all, iykyk πŸ¦‹


and that's the page!! this cutie lives in the canlock-hp 3.3.2 manual, dated 2024-05-11 β€” mwah, go free your pointers, bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from