summary refs log tree commit diff
path: root/src/machdep.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-05-30 02:06:03 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-08-29 11:16:09 +0800
commit3cd538634f71538370f5af239f342aec48b7470b (patch)
treecd38d2d317b03ae96b6a3a8a5fe79c247784f565 /src/machdep.h
parentexpand: Fix skipping of command substitution when trimming in evalvar (diff)
downloaddash-3cd538634f71538370f5af239f342aec48b7470b.tar.gz
dash-3cd538634f71538370f5af239f342aec48b7470b.zip
expand: Do not reprocess data when expanding words
Currently various paths will reprocess data when performing word
expansion.  For example, expari will skip backwards looking for
the start of the arithmetic expansion, while evalvar will skip
unexpanded words manually.

This is cumbersome and error-prone.  This patch fixes this by
making word expansions proceed in a linear fashion.  This means
changing argstr and the various expansion functions such as expari
and subevalvar to return the next character to be expanded.

This is inspired by similar code from FreeBSD.  However, we take
things one step further and completely remove the manual word
skipping in evalvar.  This is accomplished by introducing a new
EXP_DISCARD flag that tells argstr to only parse and not produce
any actual expansions.

Incidentally, argstr will now always NUL-terminate the expansion
unless the EXP_WORD flag is set.  This is because all but one
caller of argstr wants the result to be NUL-termianted.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/machdep.h')
0 files changed, 0 insertions, 0 deletions
1e50858f&follow=1'>Show other clients' cursorsJune McEnroe Also unfuck removing on send failure. 2017-07-31Perform enter as two moves rather than a loopJune McEnroe 2017-07-31Track tile access countsJune McEnroe 2017-07-31Adjust move speed in clientJune McEnroe 2017-07-31Handle large movesJune McEnroe 2017-07-30Optimize builds for chrootJune McEnroe 2017-07-30Persist bright across color changesJune McEnroe 2017-07-30Add index.htmlJune McEnroe 2017-07-30Add snapshot.shJune McEnroe 2017-07-30Fix termcap patch for background colorsJune McEnroe 2017-07-30Update helpJune McEnroe 2017-07-30Fix help to track colorJune McEnroe 2017-07-30Support background colorsJune McEnroe 2017-07-30Track color only client-sideJune McEnroe 2017-07-30Add ostensible support for background colorsJune McEnroe 2017-07-30Add tile create and access timestampsJune McEnroe 2017-07-30Assert stable struct Tile field offsetsJune McEnroe 2017-07-30Add chroot.shJune McEnroe 2017-07-30Add ` commandJune McEnroe 2017-07-30Add sshd_configJune McEnroe 2017-07-30Add termcap patchJune McEnroe