wordexp+x86_64 +linux

The wordexp module implements word expansion using shell semantics, similar to POSIX wordexp(3). Word expansion is performed with the platform-specific system shell, which is generally POSIX sh(1) compatible on Unix-like systems.

When used with a POSIX shell, the IFS variable is unconditionally unset in the environment, causing the shell to assume the default value of " \t\n".

Note that, by design, this module runs arbitrary shell commands from user-supplied inputs. It must only be used in a trusted environment.

Index

Types

type flag = enum uint {
	NONE = 0,
	// DOOFFS = (1 << 0),  // not implemented
	// APPEND = (1 << 1),  // not implemented
	// REUSE  = (1 << 3),  // not implemented
	// NOCMD   = (1 << 2), // not implemented
	SHOWERR = 1 << 4,
	UNDEF = 1 << 5,
};

Errors

type error = !(io::error | exec::error | utf8::invalid | sh_error);
type sh_error = !void;

Functions

fn strerror(err: error) const str;
fn wordexp(s: str, flags: flag = flag::NONE) ([]str | error);

Types

type flag[link]

type flag = enum uint {
	NONE = 0,
	// DOOFFS = (1 << 0),  // not implemented
	// APPEND = (1 << 1),  // not implemented
	// REUSE  = (1 << 3),  // not implemented
	// NOCMD   = (1 << 2), // not implemented
	SHOWERR = 1 << 4,
	UNDEF = 1 << 5,
};

Flags applicable to a wordexp operation.

Errors

type error[link]

type error = !(io::error | exec::error | utf8::invalid | sh_error);

Tagged union of possible wordexp error conditions.

type sh_error[link]

type sh_error = !void;

An error occured during shell expansion.

Functions

fn strerror[link]

fn strerror(err: error) const str;

Converts an error to a human-friendly string.

fn wordexp[link]

fn wordexp(s: str, flags: flag = flag::NONE) ([]str | error);

Performs shell expansion and word splitting on the provided string, returning a list of expanded words, similar to POSIX wordexp(3). Note that this function, by design, will execute arbitrary commands from the input string.

Pass the return value to strings::freeall to free resources associated with the return value.