Extra checks to ensure we don't clobber std fds
Move mrsh_state.child to mrsh_state_priv
Prefix structs in headers
Change fprintf(stderr, …, strerror(errno)) to perror
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.
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/pipeline: fix assertion
shell: fix pipeline bangs
shell/task: add pipeline bang
shell/task: add pipelines
This will get replaced with much simpler code.
Only create jobs if job control is enabled
Maintain a list of running jobs
Put commands into process groups
This is the first step towards job control support.
These we too fragile, nesting wasn't properly supported.
Instead, we now use dup() to setup and restore stdin and stdout in pipelines.