string_unescape(9)
π« string_unescape(9) π«
okay bestie, welcome to the Kernel API Manual entry for string_unescape β yes it's a real one and yes it's lowkey iconic π
β¨ NAME β¨
string_unescape β unquote characters in the given string
like, it takes your escaped little string and un-escapes it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
π¦ ARGUMENTS π¦
srcβ the source buffer (escaped). this is the one with all the backslash-y drama going on πdstβ the destination buffer (unescaped). where the chill, de-escaped version ends up πsizeβ size of the destination buffer (0 to unlimit). yes,0literally means no limit, she's quirky like that β¨flagsβ combination of the flags. pick your faves, stack 'em, go off π
π DESCRIPTION π
The function unquotes characters in the given string. simple as that, no cap.
Because the size of the output will be the same as or less than the size of the input, the transformation may be performed in place β so yes bestie, src and dst can literally be the same buffer. main character energy fr fr π₯
Caller must provide valid source and destination pointers. be so serious about this, no funny business with the pointers pls π
Be aware that the destination buffer will always be NULL-terminated. Source string must be NULL-terminated as well. both of them, terminated, non-negotiable π«Ά
The supported flags are:
UNESCAPE_SPACEβ handles the whitespace girlies:'\f'β form feed'\r'β carriage return'\n'β newline'\t'β horizontal tab'\v'β vertical tab
UNESCAPE_OCTALβ'\NNN'β byte with octal value NNN (1 to 3 digits)UNESCAPE_HEXβ'\xHH'β byte with hexadecimal value HH (1 to 2 digits)UNESCAPE_SPECIALβ the special ones, the celebrities β¨:'\"'β double quote'\\'β backslash'\a'β alert (BEL)'\e'β escape
UNESCAPE_ANYβ all previous together. the "why choose" option, she ate π
π RETURN π
The amount of the characters processed to the destination buffer excluding trailing '\0' is returned. so like, count everything except the terminator bestie, we don't count the terminator π
π SEE ALSO π
Kernel file ./lib/string_helpers.c, plus the whole friend group:
string_get_size(9)parse_int_array_user(9)string_escape_mem(9)kasprintf_strarray(9)kfree_strarray(9)skip_spaces(9)strim(9)sysfs_streq(9)match_string(9)__sysfs_match_string(9)strreplace(9)memcpy_and_pad(9)
okay that's the whole page, you're officially fluent in string_unescape π§ββοΈ this gem lives over in ./lib, dated October 2026, and it's filed under string_unescape(9) β go forth and unescape responsibly bestie, ily, bye πβπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms