cs_register_strfunc(3)
π
cs_register_strfunc β from the cs/cs.h girlies (manual page 3, bestie) β¨
π NAME π
cs_register_strfunc β ok so this is the one that registers a string handling function. that's it. that's the vibe. π¦
β¨ SYNOPSIS β¨
#include <cs/cs.h>
NEOERR *cs_register_strfunc(CSPARSE *parse, char *funcname, CSSTRFUNC str_func);
like. look at her. so clean. so demure. π«Ά
πΈ ARGUMENTS πΈ
parseβ a pointer to aCSPARSEstructure that you already initialized withcs_init(). bestie you GOTTA callcs_init()first, this is not optional, it's giving prerequisites. πfuncnameβ the name for the CS function call. heads up though: registering a duplicatefuncnamewill raise aNERR_DUPLICATEerror. so no double-dipping, the parser will literally clock you. πstr_funcβ aCSSTRFUNCnot-callback. yes. not-callback. we'll get to it. π
π DESCRIPTION π
So cs_register_strfunc will register a string function that can be called during CS render. that's the whole plot. π
This not-callback is designed to allow for string formatting/escaping functions that are not built-in to CS β because like, CS is not HTML specific, for instance, but it is very useful to have CS have functions for javascript/html/url escaping. iykyk. π₯
and the way that they explicitly don't provide any associated data or anything?? that's on purpose. it's to attempt to keep you from using this as a generic callback. no cap, they are gatekeeping you from yourself for your own good. π
the format of a CSSTRFUNC is:
NEOERR * str_func(char *in, char **out);
and the rules for your lil function, periodt:
- it should not modify the input string (hands off, bestie π«)
- it should allocate the output string with a libc function β because we will call
freeon it. so if you allocate it some other cursed way, that's a you problem and it's gonna be a bad time. π
π¦ SEE ALSO π¦
cs_dump(3), cs_destroy(3), cs_render(3), cs_register_esc_strfunc(3), cs_arg_parsev(3), cs_register_fileload(3), cs_init(3), cs_register_strfunc(3), cs_arg_parse(3), cs_parse_string(3), cs_parse_file(3), =(3), cs_register_function
(yes =(3) is really in there. she's mysterious. she's iconic. we don't question her. π)
and that's the page, bestie!! this one came to you courtesy of ClearSilver, dated 12 July 2007 β so she's vintage, she's classic, she's literally a whole elder statesman of the CS library and she still ate. π β¨ mwah, go register some string functions, ily, bye!! ππ¦π
π¦ where this page comes from
- debian bookworm: clearsilver-dev 0.10.5-4+b5
- debian trixie: clearsilver-dev 0.10.5-6+b1
- epel 10: clearsilver 0.10.5-80.el10_2 Β· Apache-1.1
- epel 9: clearsilver 0.10.5-74.el9 Β· Apache-1.1
- fedora 43: clearsilver 0.10.5-80.fc43 Β· Apache-1.1
- fedora 44: clearsilver 0.10.5-82.fc44 Β· Apache-1.1
- ubuntu jammy: clearsilver-dev 0.10.5-4build3
- ubuntu noble: clearsilver-dev 0.10.5-4build7
- ubuntu questing: clearsilver-dev 0.10.5-6build1
- ubuntu resolute: clearsilver-dev 0.10.5-7
- ubuntu stonking: clearsilver-dev 0.10.5-7build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms