shlex +linux +x86_64

The shlex module provides lexical tools for working with POSIX shell grammar.



type syntaxerr;


fn quote(io::handle, str) (size | io::error);
fn quotestr(str) str;
fn split(const str) ([]str | syntaxerr);


type syntaxerr[link]

type syntaxerr = !void;

Invalid shell syntax.


fn quote[link]

fn quote(sink: io::handle, s: str) (size | io::error);

Quotes a shell string and writes it to the provided I/O handle.

fn quotestr[link]

fn quotestr(s: str) str;

Quotes a shell string and returns a new string. The caller must free the return value.

fn split[link]

fn split(in: const str) ([]str | syntaxerr);

Splits a string of arguments according to shell quoting. The result must be freed using strings::freeall when the caller is done processing it.