glob

Glob Pattern Matching (fnmatch-style)

Functions

FunctionDescription
_glob_byte_atInternal byte reader.
_glob_match_classInternal: match character class [abc] or [!abc]. Returns packed value: matche…
_glob_do_matchInternal recursive match with bounded depth. pi=pattern index, si=string index.
glob_matchMatch a glob pattern against a string. Returns 1 if matches, 0 otherwise.
glob_has_magicCheck if pattern contains wildcard characters (*, ?, [).
glob_escapeEscape special glob characters in str. Wraps each *, ?, [, ] in [x]. Returns …

Details

_glob_byte_at

fn _glob_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_glob_match_class

fn _glob_match_class(pat: &i8, ppos: i64, plen: i64, ch: i64) -> i64

Internal: match character class [abc] or [!abc]. Returns packed value: matched + new_position * 2. Caller decodes: matched = result % 2, new_pos = result / 2.

_glob_do_match

fn _glob_do_match(pat: &i8, plen: i64, str: &i8, slen: i64, pi: i64, si: i64) -> i64

Internal recursive match with bounded depth. pi=pattern index, si=string index.

glob_match

fn glob_match(pattern: &i8, plen: i64, str: &i8, slen: i64) -> i64

Match a glob pattern against a string. Returns 1 if matches, 0 otherwise.

glob_has_magic

fn glob_has_magic(pattern: &i8, plen: i64) -> i64

Check if pattern contains wildcard characters (*, ?, [).

glob_escape

fn glob_escape(str: &i8, slen: i64, out: &i8) -> i64

Escape special glob characters in str. Wraps each *, ?, [, ] in [x]. Returns escaped length.