shell: make mrsh_run_arithm_expr take a mrsh_state
This function needs access to the shell's state to assign to variables.
mrsh_state: move loop control into call frame
mrsh_state: rename args field to frame
Change fprintf(stderr, …, strerror(errno)) to perror
shell/task: perform pathname expansion on for loop words
builtin/set: implement set -o to print all options
shell/task: simplify case clause matching
shell/task: fix case not handling quoted strings
Executing a case with a quoted string in a pattern resulted in:
mrsh: ../ast.c:343: mrsh_word_get_string: Assertion `word->type == MRSH_WORD_STRING' failed.
builtin/exit: exit immediately
shell/task/pipeline: don't leak next stdin FD
shell/job: store AST node in job
shell/task: create jobs with the pipeline/async list
Instead of creating jobs when executing their first process, create them when
creating the pipeline or async list.
This allows to track which pipeline created the job and will make possible to
attach the AST to the job in the future.
As of now, this breaks builtins such as fg(1) when called without an argument.
When executing fg(1) itself, a job is created and fg(1) picks this job instead
of the last one.
shell/task/word: don't assume jobs have one or more processes
shell: remove subshell_fork
Inline it the only place it's used, in run_command_list_array (for running
async command lists).
shell/task: don't create jobs for subshells
Instead use regular fork(2). subshell_fork will be removed in a future patch.
Remove pgid argument from job_create
Instead, decide the pgid when processes are added to the job (job_add_process).
This requires process structs to be created in the children too.
Future plans: create the jobs before spawning the child processes, so that we
can attach the AST to jobs.
shell/task/word: store lineno outside of if branch
Pointer to local array 'lineno' is stored outside the scope of this array. Such
a pointer will become invalid.
shell/task/pipeline: fix assertion
shell: fix pipeline bangs