Skip to main content

_cmdstring

Function _cmdstring 

Source
pub fn _cmdstring() -> i32
Expand description

Reach _cmdstring as a BARE COMMAND WORD, the way every upstream caller writes it — _cmdstring (Completion/Unix/Type/_cmdambivalent sh:7) — so the normal function lookup runs.

This is the DEFAULT entry point for the port, and the one a sibling port should call. It goes through crate::compsys::ported::shared::call_compfn, which supplies both of the things a bare Rust call to the body would skip: $fpath / shfunc arbitration (the user’s own copy of the function wins instead of being inert) and the doshfunc frame (a FUNCSTACK entry, and the callee’s declare_locals landing in its OWN param scope rather than the caller’s).

_cmdstring_impl is the raw body, reserved for the two callers that must not re-enter dispatch: this wrapper’s own fallback (it runs only when neither a shell function nor a registered port claims the name — i.e. unit tests with no executor installed), and the compsys::router arm, which has to target the body or dispatch would re-enter this wrapper forever.