[Toybox] realpath --relative-to

Rob Landley rob at landley.net
Wed Jun 10 06:26:41 PDT 2020


On 6/9/20 4:22 PM, enh via Toybox wrote:
> is there anything clever about realpath --relative-to, or is it just a
> textual thing? something like:
> 
>   do the regular realpath work
>   if (FLAG(relative_to)) {
>     if (result starts-with relative_to_str) {
>       remove prefix
>     } else {
>       add prefix of "../" * number of directories in relative_to_str
>     }
>   }

Sadly, there is a little bit of clever:

  ln -s /usr/bin walrus
  ls walrus/..

I tried ot get this right for cp -s but have failing test cases, haven't cycled
back around to it.

Rob



More information about the Toybox mailing list