Replying to the toybox list because I still have to boot a VM to log into
patreon to work around their website's css bug.

On 1/13/22 7:13 AM, Thomas Blankenhorn commented on your post
https://www.patreon.com/posts/instructional-61084697
> PS, on a tangent: I like how nicely the toybox shell is coming along. It has 
> now
> progressed to the point where I can enter practically any script that's short
> enough to reasonably enter at the interactive prompt. Now I'm looking forward 
> to
> the completion of your tty library and the history and command-line editing 
> that
> depend on it. These are the features I currently miss the most. By contrast,
> sShell built-ins, prcontrol-flow, process control etc are no longer the 
> limiting
> factorof usability (by me). Nice work. Thanks again!

Thanks. Glad you like it. :)

I've started trying some existing bash scripts with toysh, and the limiting
factor for running glibc's /usr/bin/ldd (which is a bash script, yes starting
with #!/bin/bash so won't run on a system without bash installed) is that my
case logic doesn't understand multiline targets, so:

  -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
  --data-rel | --data-relo | --data-reloc | --data-relocs)

confuses it. It _shouldn't_ because of the \ but I'm missing a curve somewhere.

Also, that kind of thing REALLY highlights the need for the shell to have some
variant of:

int prefix_match(char *str, char *fullstr, int min)
{
  char *a = str;

  return strstart(&a, fullstr) && a-str>min && !*a;
}

if (prefix_match(str, "--data-relocs")) printf("It's --data-relocs\n");

Easy enough to do in toybox, not sure how bash is supposed to do it but as usual
what gnu did is clearly not it. I mean yeah I could do a shell function with
something vaguely like:

premat() {
  for i in {3..${#1}}
  do
    [ "" == "${1:$i}" && "${2:1:$i}" == "${1:1:$i}" ] && return 0
  done
  return 1
}

But it seems like it would be slow? Eh...

There's also a bunch of incomplete features like job control that I have partial
implementations of in various trees:

$ for i in */.git/..; do (cd $i; git diff toys/pending/sh.c); done 2>/dev/null |
diffstat
 sh.c |  649 +++++++++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 398 insertions(+), 251 deletions(-)

But yes, toysh is to the point where lack of command history is what's limiting
_me_ from using it more. So I'm poking at it. But $DAYJOB (since new year's I'm
back at https://coresemi.io working on an ASIC tapeout) is eating bandwidth.
(Not as much as the last place, but not "days of consecutive focus" territory
either...)

Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to