~emersion/mrsh

ref: 717de1827267f238d5da1053885fcbb3c1786f9c mrsh/shell/task/word.c -rw-r--r-- 18.0 KiB
Replace assert(0) with abort()

This ensures functions reaching the asserts won't return, and avoids
issues with NDEBUG.
Only split fields on expansion/substitution results

Closes: https://github.com/emersion/mrsh/issues/144
shell/job: silence job_set_foreground warning

When job control has been turned off because of entering into a child
process, don't print a warning when calling job_set_foreground.
shell/trap: reset traps in subshells

> When a subshell is entered, traps that are not being ignored shall be set to
> the default actions, except in the case of a command substitution containing
> only a single trap command, when the traps need not be altered.

References: https://github.com/emersion/mrsh/issues/137
Add expand_pathnames error handling in expand_word
Introduce expand_word

This function performs all word expansions at once.
Move all job control related stuff to mrsh_state_priv
Prefix structs in headers
shell/task/word: implement positional parameter expansion

My life is a perfect graveyard of buried hopes.
― L.M. Montgomery
shell/task/word: add prefix/suffix trim with full pattern support
shell/task/word: implement trim prefix/suffix operator for simple patterns

"Simple pattern" means it doesn't contain special pattern characters, so it
can just be handled as a raw string.
shell/task/word: refuse to apply string param ops on $#

Refuse to apply string parameter operations on $#, except the string length
operator.
shell/task/word: make conditional parameter ops process words

This is a required step prior to adding $@ and $* support. Conditional
parameter operations can operate on those, which will need to return word
values to be able to indicate which parts can be subject to field splitting.
shell/task/word: implement indicate error parameter operator
shell/task/word: implement assign default value parameter operator
shell/task/word: simplify apply_parameter_op
shell/task/word: don't perform tilde expansion in run_word
shell/task/word: handle empty names in parameter_get_value
shell/task/word: add parameter leading hash op
shell/task/word: add parameter plus op
Next