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 fromSrc/exec.c:134 / :155 / :1052, exposed as atomics shared between this module,Src/signals.c’s port atsrc/ported/signals.rs, andSrc/params.c’s port atsrc/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) —$fpathwalker + autoload file installer. Called frombin_autoload/bin_functions -cinsrc/ported/builtin.rs.resolvebuiltin(Src/exec.c:2703) — module-autoload guard used by the dispatch walk inexeccmd_exec.execcmd_compile_head— fusevm-bytecode-time head resolver mirroring the head section (c:2904-3275) of C’sexeccmd_exec. NOT a faithful port; the canonical 7-argexeccmd_execport 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 throughexeccmd_compile_headinstead.
Re-exports§
pub use crate::ported::builtin::RETFLAG as retflag;
Modules§
- esub
- Port of
enum { ESUB_ASYNC, ESUB_PGRP, ... };fromSrc/exec.c:1056. Flag bits forentersubsh(int flags, struct entersubsh_ret *retp).
Structs§
- Eval
Context Frame - RAII form of C’s
execodecontext push/pop (Src/exec.c:1265-1266and the matchingzsh_eval_context[alen] = NULLat c:1281). - Eval
Funcstack Frame - !!! WARNING: RUST-ONLY HELPER !!!
- Subsh
FdFrame - The descriptors a bare
execredirection 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). - Subsh
Fork Copy - Subsh
State Guard - 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_retfromSrc/exec.c(forward decl). Out-arg used byentersubsh()to hand back the group-leader pid and the list-pipe job index the parent should track. Only filled in forESUB_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 Cexeccmd_execfunction carries throughc: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 insrc/extensions/compile_zsh.rs::compile_simple.
Constants§
- ADDVAR_
EXPORT - Port of the anonymous
enum { ... }fromSrc/exec.c:35-40. Flag bits passed as theaddflagsargument toaddvars/addvarsfromargs: - ADDVAR_
RESTORE ADDVAR_RESTOREconstant.- ANONYMOUS_
FUNCTION_ NAME - Port of
static const char *const ANONYMOUS_FUNCTION_NAME = "(anon)";fromSrc/exec.c:5289. Anonymous-function name marker used byis_anonymous_function_name,execfuncdef, anddoshfuncfor() { ... }anonymous function dispatch. - POUNDBANGLIMIT
POUNDBANGLIMITfromSrc/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;fromSrc/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 afterdotrap(SIGZERR)(c:1602). The checkif (!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;fromSrc/exec.c:1053. Records thelocallevelat the most recent fork point (set at c:1221:forklevel = locallevel;insideentersubsh()). Used by: - FUNC_
OFLAGS - Port of
int doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)fromSrc/exec.c:5823-6158. - LIST_
PIPE_ TEXT - Port of
mod_export int noerrs;fromSrc/exec.c:117. When non-zero, suppresszerr()output (lex error reporting duringparse_string,parseoptsetc.). Saved/restored byexecsave/execrestore. Port ofstatic char list_pipe_text[JOBTEXTSIZE]fromSrc/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 fromold_list_pipe_textat 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 Cchar[80]cap is a buffer-overflow guard, but matching length matters for thejobsbuiltin’s pipe-list rendering. - STTYval
- Port of
static char *STTYval;fromSrc/exec.c:263. Pendingsttyargument string captured byaddvarswhen the command’s inline env containsSTTY=.... Applied byexecutebefore fork - SUBSH_
PARENT_ ZLEACTIVE - The
zleactivethe shell had before the innermost in-process subshell state was applied, or-1when 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;fromSrc/exec.c:155. Carries the pending exit status from inside a trap; sentinel-2means “running an EXIT/DEBUG-style trap at the current level” (signals.c:1166). Promoted to the user’sreturn Nvalue bybin_returnwhen POSIX-trap semantics apply (builtin.c:5852). - TRAP_
STATE - Port of
int trap_state;fromSrc/exec.c:134. Tracks whether a trap handler is currently being processed and, paired withTRAP_RETURNbelow, whether areturninside the trap should promote toTRAP_STATE_FORCE_RETURNto unwind the trap caller. - cmdoutpid
- Port of
pid_t cmdoutpid;fromSrc/exec.c:215. Pid of the most recent$(cmd)command-substitution child. Used by exit-status propagation:cmdoutvalcarries the exit;cmdoutpidcarries the pidwaitpid-d for it. - cmdoutval
- Port of
int cmdoutval;fromSrc/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 commandbnfromSrc/exec.c:276. - doneps4
- Port of
static int doneps4;fromSrc/exec.c:262. Set afterprintprompt4has emitted the$PS4prefix 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;fromSrc/exec.c:2680. - exstack
- Port of
struct execstack *exstack;fromSrc/exec.c:244. Head of the linked exec-context save stack —execsavepushes a frame before signal-handler / trap dispatch;execrestorepops it afterwards so the interrupted command resumes with its state intact. - list_
pipe - Port of
int list_pipe = 0;fromSrc/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 famousAllen Edeln…comment block above this declaration in C. - list_
pipe_ child - Port of
static int list_pipe_child = 0;fromSrc/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;fromSrc/exec.c:462. Job table index of the pipeline’s first-stage job (thecatincat foo | while ...). - list_
pipe_ pid - Port of
static pid_t list_pipe_pid;fromSrc/exec.c:459. PID of the sub-shell created to host the loop-after-pipe pattern; passed up the recursiveexecliststack so the cat-job’s super- job entry can record it. - noerrexit
- Port of
int noerrexit;fromSrc/exec.c:72. Bit-flags that suppress ERREXIT triggering on the next command(s). Bits:NOERREXIT_EXIT(inif/while/untiltest contexts),NOERREXIT_RETURN(afterreturn),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;fromSrc/exec.c:122. When non-zero, the history file is not saved onexec(c:4324/c:4340), on shell exit (builtin.c:6014) or bysaveandpophiststack(hist.c:3960). Set to 1 bysetupvals(init.c:1332) and cleared once the startup files have run (init.c:1550). - nowait
- Port of
static int nowait;fromSrc/exec.c:461. When set,execplinedoesn’t wait for the pipeline; used during the list_pipe sub-shell fork bookkeeping. - pline_
level - Port of
int pline_level = 0;fromSrc/exec.c:461. Recursive pipeline depth (counts nested pipelines within the currentexeclistcall chain). - procsubstpid
- Port of
mod_export pid_t procsubstpid;fromSrc/exec.c:220. Pid of the most recent process-substitution child (<(cmd)/>(cmd)). Tracked separately fromcmdoutpidbecause procsubst jobs aren’t wait-collected by the parent until the fd is closed. - sfcontext
- Port of
mod_export int sfcontext;fromSrc/exec.c:239. Source context — one ofSFC_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 byzerr()/funcstackbuilding. - simple_
pline - Port of
int simple_pline = 0;fromSrc/exec.c:457. Set during dispatch of a “simple” pipeline (single-stage / no shell-construct tail) so thelist_pipemachinery short-circuits. - subsh
- Port of
int subsh;fromSrc/exec.c:160. Subshell depth — bumped every timeentersubshforks 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;fromSrc/exec.c:109. When set, suppress ERREXIT for THIS one command only (consumed + cleared before the next command starts). Set byexeccurshand the((expr))arith path so a 0-result doesn’t trigger errexit. - use_
cmdoutval - Port of
int use_cmdoutval;fromSrc/exec.c:234. When set,lastvalis updated fromcmdoutvalafter the command (i.e. the command had substitutions whose exit status matters). - zsh_
eval_ context - Port of
char **zsh_eval_context;fromSrc/exec.c(zsh.export:355). Stack of"context"labels used byeval-style nested execution:bin_dot,bin_eval,execode, autoloads. Eachexecode(prog, ..., "context")pushes its label and pops on return. - zsh_
subshell - Port of
int zsh_subshell;fromSrc/params.c:108. Visible$ZSH_SUBSHELLparameter — incremented byentersubsh()each time the shell forks into a subshell (real or fake-exec). Distinct fromsubshwhich records whether we ARE a subshell;zsh_subshellis the visible depth count.
Functions§
- addfd
- Port of
addfd()fromSrc/exec.c:2397— C decladdfd(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()fromSrc/exec.c:6370— C declcancd(char *s). - cancd2
- Port of
cancd2()fromSrc/exec.c:6411— C declcancd2(char *s). - checkclobberparam
- Port of
checkclobberparam()fromSrc/exec.c:2178— C declcheckclobberparam(struct redir *f). - clobber_
open - Port of
clobber_open()fromSrc/exec.c:2221— C declclobber_open(struct redir *f). - closeallelse
- Port of
closeallelse()fromSrc/exec.c:2358— C declcloseallelse(struct multio *mn). - closem
- Port of
closem()fromSrc/exec.c:4546— C declclosem(int how, int all). - closemn
- Port of
closemn()fromSrc/exec.c:2273— C declclosemn(struct multio **mfds, int fd, int type). - closemnodes
- Port of
closemnodes()fromSrc/exec.c:2344— C declclosemnodes(struct multio **mfds). - cmdsubst_
outer_ stdout - !!! WARNING: RUST-ONLY HELPER !!!
- commandnotfound
- Port of
commandnotfound()fromSrc/exec.c:669— C declcommandnotfound(char *arg0, LinkList args). - dispatch_
function_ call - !!! WARNING: RUST-ONLY HELPER !!!
- doshfunc
- Port of
doshfunc()fromSrc/exec.c:5823— C decldoshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval). - entersubsh
- Port of
entersubsh()fromSrc/exec.c:1084— C declentersubsh(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()fromSrc/exec.c:5235— C declexecarith(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()fromSrc/exec.c:5635— C declexecautofn(Estate state, UNUSED(int do_exec)). The autoload-aware dispatch entry forWC_AUTOFN: fault the function body in vialoadautofn, then hand off toexecautofn_basicto actually run it. - execautofn_
basic - Port of
execautofn_basic()fromSrc/exec.c:5608— C declexecautofn_basic(Estate state, UNUSED(int do_exec)). Run a pre-loaded autoload function body viaexecode, snapshottingscriptname/scriptfilenamearound the call so%N/%xreflect the autoload target during execution. - execcmd_
analyse - Port of
execcmd_analyse()fromSrc/exec.c:2733— C declexeccmd_analyse(Estate state, Execcmd_params eparams). Pre-execcmd_exec analysis pass: walks the wordcode atstate->pc, splits out redirs/varspc/args without expanding (no prefork, no globbing), and fillseparamsso 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()fromSrc/exec.c:2901— C declexeccmd_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()fromSrc/exec.c:2810— C declexeccmd_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()fromSrc/exec.c:2791— C declstatic void execcmd_getargs(LinkList preargs, LinkList args, int expand). Transfer the first node ofargstopreargs, performingprefork(singleton-list expansion) on the way ifexpandis set. Used byexeccmd_execto 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()fromSrc/exec.c:5260— C declexeccond(Estate state, UNUSED(int do_exec)). Run a[[ ... ]]cond expression. - execcursh
- Port of
execcursh()fromSrc/exec.c:469— C declexeccursh(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()fromSrc/exec.c:5309— C declexecfuncdef(Estate state, Eprog redir_prog). Define a shell function: extract name(s)+body from the wordcode payload, allocate the Shfunc, install intoshfunctab(named), or execute immediately (anon). - execlist
- Port of
execlist()fromSrc/exec.c:1402— C declexeclist(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()fromSrc/exec.c:1245— C declexecode(Eprog p, int dont_change_job, int exiting, char *context). DIVERGENCE: this entry drives the fusevm pipeline over aZshProgram; the faithful wordcode walker isexecode_wordcode(exec.rs:8338). zshrsexecode— run an already-parsedZshProgram(Src/exec.c:1245execode(prog, ...), called fromloop()). This is the exec.rs exception to the line-by-line port: rather than walk wordcode viaexeclist, it drives zshrs’s live engine — compile the program withcompile_zshand run it on the session executor’s fusevm VM. The faithfulloop()in init.rs calls this exactly as C calls execode. Returns$?(0 when no session executor is installed). - execode_
wordcode - Port of
execodefromSrc/exec.c:1245— C declexecode(Eprog p, int dont_change_job, int exiting, char *context). Rust fnexecode_wordcodeis the wordcode form, driving the portedexeclistinterpreter;execodeat exec.rs:8413 is the fusevm-pipeline entry that carries the C name. Set up anestatearound the given Eprog and runexeclist. Maintains thezsh_eval_contextstack so$ZSH_EVAL_CONTEXTreflects the call chain. - execpline
- Port of
execpline()fromSrc/exec.c:1668— C declexecpline(Estate state, wordcode slcode, int how, int last1). Full faithful port: allocates a job-table entry viainitjob, sets up coproc mpipes, drives the whole (multi-stage) pipeline throughexecpline2(which performs the real per-stage mpipe/fork/exec), then either spawns the job asynchronously (Z_ASYNC->spawnjob/deletejob) or waits synchronously (waitjobs), including thelist_pipestop/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()fromSrc/exec.c:1991— C declexecpline2(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 withpipes[0]as its input fd. - execrestore
- Port of
execrestore()fromSrc/exec.c:6470— C declexecrestore(void). - execsave
- Port of
execsave()fromSrc/exec.c:6438— C declexecsave(void). - execshfunc
- Port of
execshfunc()fromSrc/exec.c:5540— C declexecshfunc(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 arounddoshfunc, as C. - execsimple
- Port of
execsimple()fromSrc/exec.c:1290— C declexecsimple(Estate state). Fast-path for single-Simple commands that bypasses the fullexeccmd_execmachinery. - execstring
- Port of
execstring()fromSrc/exec.c:1228— C declexecstring(char *s, int dont_change_job, int exiting, char *context). - exectime
- Port of
exectime()fromSrc/exec.c:5272— C declexectime(Estate state, UNUSED(int do_exec)). Runtime pipeline: drives execpline with the Z_TIMED|Z_SYNC flags so it tracks wall/user/sys time. - execute
- Port of
execute()fromSrc/exec.c:723— C declexecute(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()fromSrc/exec.c:897— C declfindcmd(char *arg0, int docopy, int default_path). Walk$PATH(or DEFAULT_PATH underdefault_path=1) forarg0, returning the matching path on success._docopyis the C source’s “duplicate the result” flag — Rust ownership covers it without an explicit copy step.default_path=1forces/bin:/usr/bin:...search (used bycommand -p). - fixfds
- Port of
fixfds()fromSrc/exec.c:4523— C declfixfds(int *save). - getfpfunc
- Port of
getfpfunc()fromSrc/exec.c:6219— C declgetfpfunc(char *s, int *ksh, char **fdir, char **alt_path, int test_only). suppliedspec_pathslice) for a file namednameand writes the resolved directory through*dir_path_out(matching the Cchar **dir_path). ReturnsSome(file_path)on success,Nonewhen not found. - gethere
- Convert a here-document into a here-string. Line-by-line port of
gethere()fromSrc/exec.c:4569-4652. Reads the body from the input stream viahgetc()until the terminator line is matched, returning the collected body as a string.strpis in/out: on entry the raw terminator (possibly with token markers + leading tabs); on return the munged terminator (afterquotesubst+untokenizeand, forREDIR_HEREDOCDASH, leading-tab strip). - getherestr
- Port of
getherestr()fromSrc/exec.c:4655— C declgetherestr(struct redir *fn). - getoutput
- Port of
LinkList getoutput(char *cmd, int qt)fromSrc/exec.c:4712-4791. Runs a command-substitution body in the active executor, then routes the captured stdout throughreadoutput(pipe, qt, NULL)semantics at c:4855-4872. - getoutputfile
- Port of
getoutputfile()fromSrc/exec.c:4910— C declgetoutputfile(char *cmd, char **eptr).=(cmd)process substitution. - getpipe
- Port of
getpipe()fromSrc/exec.c:5119— C declgetpipe(char *cmd, int nullexec). - getproc
- Port of
getproc()fromSrc/exec.c:5025— C declgetproc(char *cmd, char **eptr).<(cmd)/>(cmd)process substitution via/dev/fd/N(PATH_DEV_FD branch; modern Linux/macOS). - hashcmd
- Port of
hashcmd()fromSrc/exec.c:1010— C declhashcmd(char *arg0, char **pp). - install_
session_ executor - !!! WARNING: RUST-ONLY HELPER !!!
- is_
anonymous_ function_ name - Port of
is_anonymous_function_name()fromSrc/exec.c:5300— C declis_anonymous_function_name(const char *name). - iscom
- Port of
iscom()fromSrc/exec.c:962— C decliscom(char *s). - isgooderr
- Port of
isgooderr()fromSrc/exec.c:652— C declisgooderr(int e, char *dir). - isreallycom
- Port of
isreallycom()fromSrc/exec.c:973— C declisreallycom(Cmdnam cn). - isrelative
- Port of
isrelative()fromSrc/exec.c:996— C declisrelative(char *s). - loadautofn
- Direct port of
Shfunc loadautofn(Shfunc shf, int ks, int test_only, int ignore_loaddir)fromSrc/exec.c:5682. Walks$fpathfor a file namedshf->node.nam, reads it, installs the text body on the correspondingshfunctabentry, and clearsPM_UNDEFINED. - loadautofnsetfile
- Port of
loadautofnsetfile()fromSrc/exec.c:5657— C declloadautofnsetfile(Shfunc shf, char *fdir). - makecline
- Port of
makecline()fromSrc/exec.c:2046— C declmakecline(LinkList list). - mpipe
- Port of
mpipe()fromSrc/exec.c:5160— C declmpipe(int *pp). - namedpipe
- Port of
namedpipe()fromSrc/exec.c:5001— C declnamedpipe(void). - parse_
string - Port of
parse_string()fromSrc/exec.c:283— C declparse_string(char *s, int reset_lineno). - parsecmd
- Port of
parsecmd()fromSrc/exec.c:4934— C declparsecmd(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 matchingOutpar. Returns the parsed Eprog (and writes the post-)cursor througheptr, as a BYTE offset intocmd). The tokens are multi-byte in a RustString, so the scan walks chars: comparing single bytes againstInpar/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()fromSrc/exec.c:2114— C declquote_tokenized_output(char *str, FILE *file). - readoutput
- Port of
Eprog parsecmd(char *cmd, char **eptr)fromSrc/exec.c:4878. - resolvebuiltin
- Port of
resolvebuiltin()fromSrc/exec.c:2703. — C declresolvebuiltin(const char *cmdarg, HashNode hn). the autoloaded-builtin stub firing. - restore_
params - Port of
restore_params()fromSrc/exec.c:4464— C declrestore_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()fromSrc/exec.c:6166— C declrunshfunc(Eprog prog, FuncWrap wrap, char *name). the wrapper-chain walk that stands betweendoshfuncand a function body. C: - save_
params - Port of
save_params()fromSrc/exec.c:4410— C declsave_params(Estate state, Wordcode pc, LinkList *restore_p, LinkList *remove_p). Walk WC_ASSIGN chain atpc, snapshot each existing param intorestore_p(so the builtin/shfunc can restore them on return) and enqueue every touched name inremove_p(so we know what to unset). - search_
defpath - Port of
search_defpath()fromSrc/exec.c:691— C declsearch_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()fromSrc/exec.c:2652— C declsetunderscore(char *str). - shfunc_
set_ sticky - Port of
shfunc_set_sticky()fromSrc/exec.c:5527— C declshfunc_set_sticky(Shfunc shf). - simple_
redir_ name - Port of
simple_redir_name()fromSrc/exec.c:4689— C declsimple_redir_name(Eprog prog, int redir_type). - spawnpipes
- Port of
spawnpipes()fromSrc/exec.c:5184— C declspawnpipes(LinkList l, int nullexec). - sticky_
emulation_ differs - Port of
sticky_emulation_differs()fromSrc/exec.c:5770— C declint sticky_emulation_differs(Emulation_options sticky2). - sticky_
emulation_ dup - Port of
sticky_emulation_dup()fromSrc/exec.c:5501— C declsticky_emulation_dup(Emulation_options src, int useheap). - stripkshdef
- Port of
stripkshdef()fromSrc/exec.c:6292— C declstripkshdef(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 onefunction NAME { … }definition for that name. If so, return a new Eprog whoseprog/strs/patsslice 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()fromSrc/exec.c:504— C declzexecve(char *pth, char **argv, char **newenvp). Wrapsexecve(2)with: - zfork
- Port of
zfork()fromSrc/exec.c:349— C declzfork(struct timespec *ts).