scan_ldapescape(3)
π scan_ldapescape β bestie's guide to the LDIF escape decoder π
okay so hi!! you're here because you wanna know about scan_ldapescape, the little function from the Library Functions Manual that lives in libowfat and parses LDIF escaped strings. she's not famous but she's iconic in her own quiet way, fr fr. π¦
β¨ NAME β¨
scan_ldapescape β parse LDIF escaped string π
πΈ SYNTAX πΈ
#include <libowfat/textcode.h>
size_t scan_ldapescape(const char *src,char *dest,size_t* destlen);
π DESCRIPTION π
so like, what does she do. scan_ldapescape parses LDIF escaped text from src into dest. that's the whole vibe. and then β and this is important bestie β parsing stops at the 0 terminator or at invalid input characters. so she knows when to quit, unlike your ex. π
this function will turn backslash escaped characters into their binary equivalent, i.e. a to new-line and 5c to backslash. lowkey magic honestly β¨
then scan_cescape will write the number of bytes in dest into *destlen, and return the number of bytes decoded from src. (yes girl, the manpage really says scan_cescape there β we're just reporting the facts, no editing, periodt.)
also, super flexible queen behavior:
destcan beNULL.destlencan beNULL.destcan besrc. (in-place glow-up!! π)
and the reassurance you needed: the decoded data needs at most as much space as the encoded data used. so no surprise explosions, she's chill. π«Ά
β RETURN VALUE β
scan_ldapescape returns the number of bytes successfully parsed from src. that's it, that's the number. π―
π EXAMPLES π
here's the moment you've been waiting for:
scan_ldapescape("test5C\");",buf,&i) -> return 7, i=5, buf="test\" (C notation).
she ate that. πβ¨ return 7, i=5, buf becomes "test\" in C notation.
π SEE ALSO π
fmt_ldapescape(3)scan_cescape(3)scan_ldapescape(3)
ngl bestie, if you take nothing else from this page, take this: check yourdestlen, respect the0terminator, and never trust an escape sequence you didn't decode yourself. π
and that's the whole page!! this lil cutie comes to you from the Library Functions Manual β scan_ldapescape(3), mwah, go forth and parse responsibly. π
πΈπ¦
π¦ 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