parser/arithm: fix && and ||
"&" and "|" have higher priority, so they were consuming the first character of
"&&" and "||", leaving a trailing "&" or "|".
parser/arithm: fix comparison operators
> and < were recognized before >= and <=. For this reason, >= and <= were never
parsed (since they are prefixes of < and >).
builtin/hash: new utility
This implements a minimal hash(1) utility, without any caching.
builtin/pwd: implement -L and -P
Note that this is mostly a placation, because mrsh manages the PWD
variable and ensures that none of the conditions -P or -L are meant to
address will occur.
shell/arithm: implement assignments
The parser still chokes on assignments with an operation.
shell/arithm: strip mrsh_ prefix for static functions
The mrsh_ prefix is reserved for exported, public functions.
shell: make mrsh_run_arithm_expr take a mrsh_state
This function needs access to the shell's state to assign to variables.
builtins: implement return
mrsh_state: move loop control into call frame
mrsh_state: rename args field to frame
unspecified builtins: add missing newline
frontend/readline: fix undefined rl_replace_line with editline
editline doesn't define rl_replace_line. I haven't found a good way to make
SIGINT handling work with editline, let's just disable it for now.
Fixes: 763feb2ee5dd ("readline: reset on SIGINT")
readline: reset on SIGINT
builtin/export: expand tildes in value
Fixes the following:
configure: Only add -I CFLAGS from readline (#116)
Adding the readline CFLAGS to our own can define undesired symbols,
like for _GNU_SOURCE and _XOPEN_SOURCE.
We take extra precautions to remove _GNU_SOURCE
but a stray _XOPEN_SOURCE can break our build due to redefined symbols.
This change modifies the pkgconfig invocation
to only add the -I CFLAGS of the readline package,
which don't include symbol definitions
and spares us the trouble of having to remove them.
Change fprintf(stderr, …, strerror(errno)) to perror
shell/job: fix setpgid failed if session leader
The process group ID of a session leader cannot change.
Print warning when failing to enable job control
shell/task: perform pathname expansion on for loop words
builtin/set: implement set -o to print all options