shell
Shell Word Splitting and Escaping
Functions
| Function | Description |
|---|---|
shell_needs_escape | Internal: does this byte need escaping in a shell context? |
shell_escape | Escape a string for safe shell use with backslashes. Returns output length. |
shell_quote | Single-quote a string (strongest quoting). Handles embedded single quotes wit… |
shell_join | Join multiple words into a single shell-safe string with spaces. words: array… |
shell_split | Split a shell string into words respecting quotes. Stores offsets and lengths… |
Details
shell_needs_escape
fn shell_needs_escape(ch: i64) -> i64Internal: does this byte need escaping in a shell context?
shell_escape
fn shell_escape(src: &i8, len: i64, dst: &i8) -> i64Escape a string for safe shell use with backslashes. Returns output length.
shell_quote
fn shell_quote(src: &i8, len: i64, dst: &i8) -> i64Single-quote a string (strongest quoting). Handles embedded single quotes with ‘'’ sequence.
shell_join
fn shell_join(words: &i64, lengths: &i64, count: i64, dst: &i8) -> i64Join multiple words into a single shell-safe string with spaces. words: array of &i8 pointers, lengths: array of i64.
shell_split
fn shell_split(src: &i8, len: i64, offsets: &i64, lengths: &i64) -> i64Split a shell string into words respecting quotes. Stores offsets and lengths into provided arrays. Returns number of words found.