Skip to main content

Module exec

Module exec 

Source
Expand description

exec submodule. Faithful Rust ports of free functions and file-static globals from Src/exec.c. The wordcode-VM dispatch tree (execlist / execpline / execcmd / execsimple etc.) that drives execution in C zsh is NOT replicated here — zshrs runs the fusevm bytecode VM instead (see src/vm_helper.rs + src/fusevm_bridge.rs).

What lives here are the parts of Src/exec.c that ARE faithful ports and don’t depend on the C-side wordcode walker:

  • trap_state / trap_return / forklevel — file-static integer globals from Src/exec.c:134 / :155 / :1052, exposed as atomics shared between this module, Src/signals.c’s port at src/ported/signals.rs, and Src/params.c’s port at src/ported/params.rs.
  • gethere (Src/exec.c:4573) — turn a here-document into a here-string. Called from the lexer port (src/ported/lex.rs).
  • getoutput (Src/exec.c:4712) — command-substitution body runner. Called from the parameter-expansion port (src/ported/subst.rs).
  • loadautofn + getfpfunc (Src/exec.c:5682 / :6219) — $fpath walker + autoload file installer. Called from bin_autoload / bin_functions -c in src/ported/builtin.rs.
  • resolvebuiltin (Src/exec.c:2703) — module-autoload guard used by the dispatch walk in execcmd_exec.
  • execcmd_compile_head — fusevm-bytecode-time head resolver mirroring the head section (c:2904-3275) of C’s execcmd_exec. NOT a faithful port; the canonical 7-arg execcmd_exec port lives alongside it.
  • execcmd_exec (Src/exec.c:2900) — canonical 7-arg port of the C function (locals + dispatch walk through builtin/shfunc/external invocation). Used by future tree-walker callers; the fusevm bytecode flow goes through execcmd_compile_head instead.

Re-exports§

pub use crate::ported::builtin::RETFLAG as retflag;

Modules§

esub
Port of enum { ESUB_ASYNC, ESUB_PGRP, ... }; from Src/exec.c:1056. Flag bits for entersubsh(int flags, struct entersubsh_ret *retp).

Structs§

EvalContextFrame
RAII form of C’s execode context push/pop (Src/exec.c:1265-1266 and the matching zsh_eval_context[alen] = NULL at c:1281).
EvalFuncstackFrame
!!! WARNING: RUST-ONLY HELPER !!!
SubshFdFrame
The descriptors a bare exec redirection moved inside an in-process subshell, each with a copy of what it was before, and the ones the body opened for itself ({var}, sysopen -u, zsystem flock -f).
SubshForkCopy
SubshStateGuard
RAII guard applying the fork-safe subset of entersubsh(ESUB_PGRP|ESUB_NOMONITOR, NULL) (Src/exec.c:1083) around a command substitution that zshrs runs in-process, restoring every touched global on drop.
entersubsh_ret
Port of struct entersubsh_ret from Src/exec.c (forward decl). Out-arg used by entersubsh() to hand back the group-leader pid and the list-pipe job index the parent should track. Only filled in for ESUB_PGRP + non-async forks (synchronous pipeline child groups).
execcmd_dispatch
Dispatch decision returned by execcmd_compile_head — the fusevm-bytecode-time head resolver that mirrors the local-variable state the C execcmd_exec function carries through c:2913-2916 (is_builtin, is_shfunc, cflags, use_defpath) plus the precmd-modifier strip count. The fusevm bytecode compiler reads this to emit the correct dispatch opcode in src/extensions/compile_zsh.rs::compile_simple.

Constants§

ADDVAR_EXPORT
Port of the anonymous enum { ... } from Src/exec.c:35-40. Flag bits passed as the addflags argument to addvars / addvarsfromargs:
ADDVAR_RESTORE
ADDVAR_RESTORE constant.
ANONYMOUS_FUNCTION_NAME
Port of static const char *const ANONYMOUS_FUNCTION_NAME = "(anon)"; from Src/exec.c:5289. Anonymous-function name marker used by is_anonymous_function_name, execfuncdef, and doshfunc for () { ... } anonymous function dispatch.
POUNDBANGLIMIT
POUNDBANGLIMIT from Src/exec.c:500 — max bytes read from the front of a script when probing for a #! shebang line.

Statics§

DONETRAP
Port of static int donetrap; from Src/exec.c:1351. Tracks whether the ZERR trap has already fired for the current sublist. C source resets to 0 at sublist start (c:1455) and sets to 1 after dotrap(SIGZERR) (c:1602). The check if (!this_noerrexit && !donetrap && !this_donetrap) at c:1598 suppresses re-firing within the same sublist AND, crucially, carries the “already fired” state across a function-call return boundary so the outer caller’s post-command check doesn’t fire ZERR a second time for the same logical error. Bug #303 in docs/BUGS.md.
FORKLEVEL
Port of int forklevel; from Src/exec.c:1053. Records the locallevel at the most recent fork point (set at c:1221: forklevel = locallevel; inside entersubsh()). Used by:
FUNC_OFLAGS
Port of int doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval) from Src/exec.c:5823-6158.
LIST_PIPE_TEXT
Port of mod_export int noerrs; from Src/exec.c:117. When non-zero, suppress zerr() output (lex error reporting during parse_string, parseopts etc.). Saved/restored by execsave/execrestore. Port of static char list_pipe_text[JOBTEXTSIZE] from Src/exec.c:463. Holds the textual rendering of the in-flight pipe list; saved across nested execlist invocations at exec.c:1372-1380 (zeroed on entry, restored from old_list_pipe_text at c:1634-1638) and round-tripped through execsave/execrestore (c:6448 / c:6484). zshrs models it as a length-bounded String guarded by a Mutex — the C char[80] cap is a buffer-overflow guard, but matching length matters for the jobs builtin’s pipe-list rendering.
STTYval
Port of static char *STTYval; from Src/exec.c:263. Pending stty argument string captured by addvars when the command’s inline env contains STTY=.... Applied by execute before fork
SUBSH_PARENT_ZLEACTIVE
The zleactive the shell had before the innermost in-process subshell state was applied, or -1 when no such state is in effect.
SUBSH_STATE_DEPTH
Nesting depth of the in-process subshell state above.
TRAP_RETURN
Port of int trap_return; from Src/exec.c:155. Carries the pending exit status from inside a trap; sentinel -2 means “running an EXIT/DEBUG-style trap at the current level” (signals.c:1166). Promoted to the user’s return N value by bin_return when POSIX-trap semantics apply (builtin.c:5852).
TRAP_STATE
Port of int trap_state; from Src/exec.c:134. Tracks whether a trap handler is currently being processed and, paired with TRAP_RETURN below, whether a return inside the trap should promote to TRAP_STATE_FORCE_RETURN to unwind the trap caller.
cmdoutpid
Port of pid_t cmdoutpid; from Src/exec.c:215. Pid of the most recent $(cmd) command-substitution child. Used by exit-status propagation: cmdoutval carries the exit; cmdoutpid carries the pid waitpid-d for it.
cmdoutval
Port of int cmdoutval; from Src/exec.c:225. Exit status of the most recent $(cmd). Drives $? when a varspc-only command runs alongside a substitution.
commandbn
Port of static struct builtin commandbn from Src/exec.c:276.
doneps4
Port of static int doneps4; from Src/exec.c:262. Set after printprompt4 has emitted the $PS4 prefix for the current xtrace command — prevents double-printing when an inner sub-eval also wants to xtrace.
esglob
esprefork
Port of static int esprefork, esglob = 1; from Src/exec.c:2680.
exstack
Port of struct execstack *exstack; from Src/exec.c:244. Head of the linked exec-context save stack — execsave pushes a frame before signal-handler / trap dispatch; execrestore pops it afterwards so the interrupted command resumes with its state intact.
list_pipe
Port of int list_pipe = 0; from Src/exec.c:457. Set when the currently-executing pipeline is the long-running pipe-into-loop shape (cat foo | while read a; do ... done) — drives the super/sub-job tracking documented in the famous Allen Edeln… comment block above this declaration in C.
list_pipe_child
Port of static int list_pipe_child = 0; from Src/exec.c:462. Set in the child after the list_pipe fork so the child knows to continue executing the loop body (vs the parent which records the pid + returns).
list_pipe_job
Port of static int list_pipe_job; from Src/exec.c:462. Job table index of the pipeline’s first-stage job (the cat in cat foo | while ...).
list_pipe_pid
Port of static pid_t list_pipe_pid; from Src/exec.c:459. PID of the sub-shell created to host the loop-after-pipe pattern; passed up the recursive execlist stack so the cat-job’s super- job entry can record it.
noerrexit
Port of int noerrexit; from Src/exec.c:72. Bit-flags that suppress ERREXIT triggering on the next command(s). Bits: NOERREXIT_EXIT (in if/while/until test contexts), NOERREXIT_RETURN (after return), NOERREXIT_UNTIL_EXEC (until next exec’d command). Bucket-1 — per-evaluator (each recursive eval has its own suppression frame).
nohistsave
Port of int nohistsave; from Src/exec.c:122. When non-zero, the history file is not saved on exec (c:4324/c:4340), on shell exit (builtin.c:6014) or by saveandpophiststack (hist.c:3960). Set to 1 by setupvals (init.c:1332) and cleared once the startup files have run (init.c:1550).
nowait
Port of static int nowait; from Src/exec.c:461. When set, execpline doesn’t wait for the pipeline; used during the list_pipe sub-shell fork bookkeeping.
pline_level
Port of int pline_level = 0; from Src/exec.c:461. Recursive pipeline depth (counts nested pipelines within the current execlist call chain).
procsubstpid
Port of mod_export pid_t procsubstpid; from Src/exec.c:220. Pid of the most recent process-substitution child (<(cmd) / >(cmd)). Tracked separately from cmdoutpid because procsubst jobs aren’t wait-collected by the parent until the fd is closed.
sfcontext
Port of mod_export int sfcontext; from Src/exec.c:239. Source context — one of SFC_NONE, SFC_DIRECT (user typed it), SFC_SIGNAL (trap firing), SFC_HOOK (precmd/preexec etc.), SFC_WIDGET (ZLE widget), SFC_COMPLETE (completion fn), SFC_CFUNC (compsys fn), SFC_SUBST ($(…) cmd-subst), SFC_EVAL (eval body). Read by zerr() / funcstack building.
simple_pline
Port of int simple_pline = 0; from Src/exec.c:457. Set during dispatch of a “simple” pipeline (single-stage / no shell-construct tail) so the list_pipe machinery short-circuits.
subsh
Port of int subsh; from Src/exec.c:160. Subshell depth — bumped every time entersubsh forks a sub-shell, used by signal handling (different SIGINT semantics in subshells) and by ${$$} ($$ stays at the top-level pid).
this_noerrexit
Port of int this_noerrexit; from Src/exec.c:109. When set, suppress ERREXIT for THIS one command only (consumed + cleared before the next command starts). Set by execcursh and the ((expr)) arith path so a 0-result doesn’t trigger errexit.
use_cmdoutval
Port of int use_cmdoutval; from Src/exec.c:234. When set, lastval is updated from cmdoutval after the command (i.e. the command had substitutions whose exit status matters).
zsh_eval_context
Port of char **zsh_eval_context; from Src/exec.c (zsh.export:355). Stack of "context" labels used by eval-style nested execution: bin_dot, bin_eval, execode, autoloads. Each execode(prog, ..., "context") pushes its label and pops on return.
zsh_subshell
Port of int zsh_subshell; from Src/params.c:108. Visible $ZSH_SUBSHELL parameter — incremented by entersubsh() each time the shell forks into a subshell (real or fake-exec). Distinct from subsh which records whether we ARE a subshell; zsh_subshell is the visible depth count.

Functions§

addfd
Port of addfd() from Src/exec.c:2397 — C decl addfd(int forked, int *save, struct multio **mfds, int fd1, int fd2, int rflag, char *varid). int fd1, int fd2, int rflag, char *varid)fromSrc/exec.c:2397`.
array
!!! WARNING: RUST-ONLY HELPER !!!
assoc
!!! WARNING: RUST-ONLY HELPER !!!
cancd
Port of cancd() from Src/exec.c:6370 — C decl cancd(char *s).
cancd2
Port of cancd2() from Src/exec.c:6411 — C decl cancd2(char *s).
checkclobberparam
Port of checkclobberparam() from Src/exec.c:2178 — C decl checkclobberparam(struct redir *f).
clobber_open
Port of clobber_open() from Src/exec.c:2221 — C decl clobber_open(struct redir *f).
closeallelse
Port of closeallelse() from Src/exec.c:2358 — C decl closeallelse(struct multio *mn).
closem
Port of closem() from Src/exec.c:4546 — C decl closem(int how, int all).
closemn
Port of closemn() from Src/exec.c:2273 — C decl closemn(struct multio **mfds, int fd, int type).
closemnodes
Port of closemnodes() from Src/exec.c:2344 — C decl closemnodes(struct multio **mfds).
cmdsubst_outer_stdout
!!! WARNING: RUST-ONLY HELPER !!!
commandnotfound
Port of commandnotfound() from Src/exec.c:669 — C decl commandnotfound(char *arg0, LinkList args).
dispatch_function_call
!!! WARNING: RUST-ONLY HELPER !!!
doshfunc
Port of doshfunc() from Src/exec.c:5823 — C decl doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval).
entersubsh
Port of entersubsh() from Src/exec.c:1084 — C decl entersubsh(int flags, struct entersubsh_ret *retp). Called by every child fork to switch the process into subshell mode: traps reset, monitor disabled, signals re-defaulted, pgrp + tty handed off, saved fds closed, jobtab cleared, ZSH_SUBSHELL bumped, forklevel = locallevel.
execarith
Port of execarith() from Src/exec.c:5235 — C decl execarith(Estate state, UNUSED(int do_exec)). Run a (( ... )) arithmetic command; returns 0 when val != 0 (success), 1 when val == 0 (false), 2 on parse error.
execautofn
Port of execautofn() from Src/exec.c:5635 — C decl execautofn(Estate state, UNUSED(int do_exec)). The autoload-aware dispatch entry for WC_AUTOFN: fault the function body in via loadautofn, then hand off to execautofn_basic to actually run it.
execautofn_basic
Port of execautofn_basic() from Src/exec.c:5608 — C decl execautofn_basic(Estate state, UNUSED(int do_exec)). Run a pre-loaded autoload function body via execode, snapshotting scriptname/scriptfilename around the call so %N / %x reflect the autoload target during execution.
execcmd_analyse
Port of execcmd_analyse() from Src/exec.c:2733 — C decl execcmd_analyse(Estate state, Execcmd_params eparams). Pre-execcmd_exec analysis pass: walks the wordcode at state->pc, splits out redirs/varspc/args without expanding (no prefork, no globbing), and fills eparams so the caller (execcmd_exec at c:2901 or execpline2 at c:2013) can branch on the command type before the real work.
execcmd_compile_head
!!! WARNING: RUST-ONLY HELPER !!!
execcmd_exec
Port of execcmd_exec() from Src/exec.c:2901 — C decl execcmd_exec(Estate state, Execcmd_params eparams, int input, int output, int how, int last1, int close_if_forked). int input, int output, int how, int last1, int close_if_forked)fromSrc/exec.c:2900-4404`. Execute a command at the lowest level of the hierarchy.
execcmd_fork
Port of execcmd_fork() from Src/exec.c:2810 — C decl execcmd_fork(Estate state, int how, int type, Wordcode varspc, LinkList *filelistp, char *text, int oautocont, int close_if_forked). Wordcode varspc, LinkList *filelistp, char *text, int oautocont, int close_if_forked)fromSrc/exec.c:2810-2893`.
execcmd_getargs
Port of execcmd_getargs() from Src/exec.c:2791 — C decl static void execcmd_getargs(LinkList preargs, LinkList args, int expand). Transfer the first node of args to preargs, performing prefork (singleton-list expansion) on the way if expand is set. Used by execcmd_exec to pull the command head one word at a time so prefix-modifier walking (BINF_COMMAND, BINF_EXEC etc.) sees expanded names.
execcond
Port of execcond() from Src/exec.c:5260 — C decl execcond(Estate state, UNUSED(int do_exec)). Run a [[ ... ]] cond expression.
execcursh
Port of execcursh() from Src/exec.c:469 — C decl execcursh(Estate state, int do_exec). Execute a { ... } current-shell command group: skip the trailing try-only word, optionally drop a stale job slot, then run the inner list.
execfuncdef
Port of execfuncdef() from Src/exec.c:5309 — C decl execfuncdef(Estate state, Eprog redir_prog). Define a shell function: extract name(s)+body from the wordcode payload, allocate the Shfunc, install into shfunctab (named), or execute immediately (anon).
execlist
Port of execlist() from Src/exec.c:1402 — C decl execlist(Estate state, int dont_change_job, int exiting). Walks WC_LIST entries, dispatches each sublist (WC_SUBLIST chain inlined, same as C — there is no separate execsublist function), runs the DEBUG / ERR / EXIT traps and applies ERREXIT / ERRRETURN.
execode
Port of execode() from Src/exec.c:1245 — C decl execode(Eprog p, int dont_change_job, int exiting, char *context). DIVERGENCE: this entry drives the fusevm pipeline over a ZshProgram; the faithful wordcode walker is execode_wordcode (exec.rs:8338). zshrs execode — run an already-parsed ZshProgram (Src/exec.c:1245 execode(prog, ...), called from loop()). This is the exec.rs exception to the line-by-line port: rather than walk wordcode via execlist, it drives zshrs’s live engine — compile the program with compile_zsh and run it on the session executor’s fusevm VM. The faithful loop() in init.rs calls this exactly as C calls execode. Returns $? (0 when no session executor is installed).
execode_wordcode
Port of execode from Src/exec.c:1245 — C decl execode(Eprog p, int dont_change_job, int exiting, char *context). Rust fn execode_wordcode is the wordcode form, driving the ported execlist interpreter; execode at exec.rs:8413 is the fusevm-pipeline entry that carries the C name. Set up an estate around the given Eprog and run execlist. Maintains the zsh_eval_context stack so $ZSH_EVAL_CONTEXT reflects the call chain.
execpline
Port of execpline() from Src/exec.c:1668 — C decl execpline(Estate state, wordcode slcode, int how, int last1). Full faithful port: allocates a job-table entry via initjob, sets up coproc mpipes, drives the whole (multi-stage) pipeline through execpline2 (which performs the real per-stage mpipe/fork/exec), then either spawns the job asynchronously (Z_ASYNC -> spawnjob/deletejob) or waits synchronously (waitjobs), including the list_pipe stop/continue fork machinery (SUBJOB/SUPERJOB linkage) that re-forks the shell to keep an interactively-suspended right-hand pipeline stage running.
execpline2
Port of execpline2() from Src/exec.c:1991 — C decl execpline2(Estate state, wordcode pcode, int how, int input, int output, int last1). Recursive multi-stage pipe walker: at each step, analyse the current command, fork-into-pipe (if mid-pipeline) or exec directly (if WC_PIPE_END), then recurse on the next stage with pipes[0] as its input fd.
execrestore
Port of execrestore() from Src/exec.c:6470 — C decl execrestore(void).
execsave
Port of execsave() from Src/exec.c:6438 — C decl execsave(void).
execshfunc
Port of execshfunc() from Src/exec.c:5540 — C decl execshfunc(Shfunc shf, LinkList args). execshfunc(Shfunc shf, LinkList args) — Src/exec.c:5540. Promoted to top-level pub fn so execcmd_exec at the shfunc dispatch site (c:4102-4105) can route through it. Owns the queue_signals + cmdstack + sfcontext setup around doshfunc, as C.
execsimple
Port of execsimple() from Src/exec.c:1290 — C decl execsimple(Estate state). Fast-path for single-Simple commands that bypasses the full execcmd_exec machinery.
execstring
Port of execstring() from Src/exec.c:1228 — C decl execstring(char *s, int dont_change_job, int exiting, char *context).
exectime
Port of exectime() from Src/exec.c:5272 — C decl exectime(Estate state, UNUSED(int do_exec)). Run time pipeline: drives execpline with the Z_TIMED|Z_SYNC flags so it tracks wall/user/sys time.
execute
Port of execute() from Src/exec.c:723 — C decl execute(LinkList args, int flags, int defpath). The canonical “child runs the simple external command” path: STTY/ARGV0/BINF_DASH handling, makecline, closem(FDT_XTRACE) + child_unblock, slash-path direct exec, defpath (command -p) search, cmdnamtab + $PATH walk, with commandnotfound-handler fallback and the final exit-code escape (127 not-found / 126 noperm).
execute_script
!!! WARNING: RUST-ONLY HELPER !!!
execute_script_zsh_pipeline
!!! WARNING: RUST-ONLY HELPER !!!
findcmd
Port of findcmd() from Src/exec.c:897 — C decl findcmd(char *arg0, int docopy, int default_path). Walk $PATH (or DEFAULT_PATH under default_path=1) for arg0, returning the matching path on success. _docopy is the C source’s “duplicate the result” flag — Rust ownership covers it without an explicit copy step. default_path=1 forces /bin:/usr/bin:... search (used by command -p).
fixfds
Port of fixfds() from Src/exec.c:4523 — C decl fixfds(int *save).
getfpfunc
Port of getfpfunc() from Src/exec.c:6219 — C decl getfpfunc(char *s, int *ksh, char **fdir, char **alt_path, int test_only). supplied spec_path slice) for a file named name and writes the resolved directory through *dir_path_out (matching the C char **dir_path). Returns Some(file_path) on success, None when not found.
gethere
Convert a here-document into a here-string. Line-by-line port of gethere() from Src/exec.c:4569-4652. Reads the body from the input stream via hgetc() until the terminator line is matched, returning the collected body as a string. strp is in/out: on entry the raw terminator (possibly with token markers + leading tabs); on return the munged terminator (after quotesubst + untokenize and, for REDIR_HEREDOCDASH, leading-tab strip).
getherestr
Port of getherestr() from Src/exec.c:4655 — C decl getherestr(struct redir *fn).
getoutput
Port of LinkList getoutput(char *cmd, int qt) from Src/exec.c:4712-4791. Runs a command-substitution body in the active executor, then routes the captured stdout through readoutput(pipe, qt, NULL) semantics at c:4855-4872.
getoutputfile
Port of getoutputfile() from Src/exec.c:4910 — C decl getoutputfile(char *cmd, char **eptr). =(cmd) process substitution.
getpipe
Port of getpipe() from Src/exec.c:5119 — C decl getpipe(char *cmd, int nullexec).
getproc
Port of getproc() from Src/exec.c:5025 — C decl getproc(char *cmd, char **eptr). <(cmd) / >(cmd) process substitution via /dev/fd/N (PATH_DEV_FD branch; modern Linux/macOS).
hashcmd
Port of hashcmd() from Src/exec.c:1010 — C decl hashcmd(char *arg0, char **pp).
install_session_executor
!!! WARNING: RUST-ONLY HELPER !!!
is_anonymous_function_name
Port of is_anonymous_function_name() from Src/exec.c:5300 — C decl is_anonymous_function_name(const char *name).
iscom
Port of iscom() from Src/exec.c:962 — C decl iscom(char *s).
isgooderr
Port of isgooderr() from Src/exec.c:652 — C decl isgooderr(int e, char *dir).
isreallycom
Port of isreallycom() from Src/exec.c:973 — C decl isreallycom(Cmdnam cn).
isrelative
Port of isrelative() from Src/exec.c:996 — C decl isrelative(char *s).
loadautofn
Direct port of Shfunc loadautofn(Shfunc shf, int ks, int test_only, int ignore_loaddir) from Src/exec.c:5682. Walks $fpath for a file named shf->node.nam, reads it, installs the text body on the corresponding shfunctab entry, and clears PM_UNDEFINED.
loadautofnsetfile
Port of loadautofnsetfile() from Src/exec.c:5657 — C decl loadautofnsetfile(Shfunc shf, char *fdir).
makecline
Port of makecline() from Src/exec.c:2046 — C decl makecline(LinkList list).
mpipe
Port of mpipe() from Src/exec.c:5160 — C decl mpipe(int *pp).
namedpipe
Port of namedpipe() from Src/exec.c:5001 — C decl namedpipe(void).
parse_string
Port of parse_string() from Src/exec.c:283 — C decl parse_string(char *s, int reset_lineno).
parsecmd
Port of parsecmd() from Src/exec.c:4934 — C decl parsecmd(char *cmd, char **eptr). Lex a <(...)/>(...)/=(...) body — the leading 2 chars are the marker pair (Inang+Inpar, Outang+Inpar, Equals+Inpar), remainder is the command up to the matching Outpar. Returns the parsed Eprog (and writes the post-) cursor through eptr, as a BYTE offset into cmd). The tokens are multi-byte in a Rust String, so the scan walks chars: comparing single bytes against Inpar / Outpar (as the port did) could never match and every call failed.
pparams
!!! WARNING: RUST-ONLY HELPER !!!
quote_tokenized_output
Port of quote_tokenized_output() from Src/exec.c:2114 — C decl quote_tokenized_output(char *str, FILE *file).
readoutput
Port of Eprog parsecmd(char *cmd, char **eptr) from Src/exec.c:4878.
resolvebuiltin
Port of resolvebuiltin() from Src/exec.c:2703. — C decl resolvebuiltin(const char *cmdarg, HashNode hn). the autoloaded-builtin stub firing.
restore_params
Port of restore_params() from Src/exec.c:4464 — C decl restore_params(LinkList restorelist, LinkList removelist). After the builtin/shfunc returns, unset every name in removelist, then for each saved param in restorelist re-install its values (PM_SPECIAL go through gsu setfn; regular params re-enter paramtab as-is).
run_command_substitution
!!! WARNING: RUST-ONLY HELPER !!!
run_function_body
!!! WARNING: RUST-ONLY HELPER !!!
runshfunc
Port of runshfunc() from Src/exec.c:6166 — C decl runshfunc(Eprog prog, FuncWrap wrap, char *name). the wrapper-chain walk that stands between doshfunc and a function body. C:
save_params
Port of save_params() from Src/exec.c:4410 — C decl save_params(Estate state, Wordcode pc, LinkList *restore_p, LinkList *remove_p). Walk WC_ASSIGN chain at pc, snapshot each existing param into restore_p (so the builtin/shfunc can restore them on return) and enqueue every touched name in remove_p (so we know what to unset).
search_defpath
Port of search_defpath() from Src/exec.c:691 — C decl search_defpath(char *cmd, char *pbuf, int plen).
set_array
!!! WARNING: RUST-ONLY HELPER !!!
set_assoc
!!! WARNING: RUST-ONLY HELPER !!!
set_pparams
!!! WARNING: RUST-ONLY HELPER !!!
setunderscore
Port of setunderscore() from Src/exec.c:2652 — C decl setunderscore(char *str).
shfunc_set_sticky
Port of shfunc_set_sticky() from Src/exec.c:5527 — C decl shfunc_set_sticky(Shfunc shf).
simple_redir_name
Port of simple_redir_name() from Src/exec.c:4689 — C decl simple_redir_name(Eprog prog, int redir_type).
spawnpipes
Port of spawnpipes() from Src/exec.c:5184 — C decl spawnpipes(LinkList l, int nullexec).
sticky_emulation_differs
Port of sticky_emulation_differs() from Src/exec.c:5770 — C decl int sticky_emulation_differs(Emulation_options sticky2).
sticky_emulation_dup
Port of sticky_emulation_dup() from Src/exec.c:5501 — C decl sticky_emulation_dup(Emulation_options src, int useheap).
stripkshdef
Port of stripkshdef() from Src/exec.c:6292 — C decl stripkshdef(Eprog prog, char *name). Given an Eprog read from an autoload file plus the function name being defined, check whether the file consists of exactly one function NAME { … } definition for that name. If so, return a new Eprog whose prog/strs/ pats slice out just the function body (so calling code can invoke the body directly instead of re-parsing). Otherwise return the input untouched.
unregister_function
!!! WARNING: RUST-ONLY HELPER !!!
unset_array
!!! WARNING: RUST-ONLY HELPER !!!
unset_assoc
!!! WARNING: RUST-ONLY HELPER !!!
unset_scalar
!!! WARNING: RUST-ONLY HELPER !!!
zexecve
Port of zexecve() from Src/exec.c:504 — C decl zexecve(char *pth, char **argv, char **newenvp). Wraps execve(2) with:
zfork
Port of zfork() from Src/exec.c:349 — C decl zfork(struct timespec *ts).