scan_cescape(3)
β¨ scan_cescape β NAME β¨
okay bestie, gather round π this one's scan_cescape from section 3 of the Library Functions Manual, and its whole job is literally just parse C escaped string. that's it. that's the vibe. π
π¦ SYNTAX π¦
first you gotta invite it in:
#include <libowfat/textcode.h>
then the actual signature, no cap:
size_t scan_cescape(const char *src,char *dest,size_t* destlen);
π DESCRIPTION π
so like. scan_cescape parses C escaped text out of src and drops it into dest. it's giving little translator fairy π§
parsing stops when it hits:
- the
0terminator - invalid input characters
- a double quote that was not escaped
and then β the glow up β C escape sequences like \n and \x0a and \012 get translated into their binary counterparts. periodt. π
the C99 escape sequences \u and \U are also supported (iconic of them honestly) and those lead to UTF-8 sequences being output β¨
after that, scan_cescape writes the number of bytes in dest into *destlen, and returns the number of bytes decoded from src. two numbers, one function, main character energy fr fr π
now the flexible part, and it's lowkey wild:
destcan beNULL.destlencan beNULL.destcan besrc.
πΈ bestie if you're worried aboutdestnot being big enough: either allocatestrlen(src)+1bytes, or callscan_cescapetwice β the first time withdest == NULL. and yes,*destlenwill still be written even then. we love a reconnaissance mission π΅οΈβοΈ
π₯ RETURN VALUE π₯
scan_cescape returns the number of bytes successfully parsed from src. that's the receipt, keep it π§Ύ
π EXAMPLES π
scan_cescape("test\n
(yes that's the whole example, it's a little mysterious, it's giving cliffhanger π)
π SEE ALSO π
fmt_jsonescape(3)fmt_cescape(3)scan_ldapescape(3)
go read those next, iykyk π«Ά
k bye love u, this was scan_cescape(3) from the Library Functions Manual β section 3, the library functions girlies π β
π¦ 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