[Toybox] [PATCH] cp: fix -D (--parents)
Rob Landley
rob at landley.net
Sun Mar 8 12:00:48 PDT 2020
On 3/8/20 1:48 PM, Jarno Mäkipää wrote:
> Oh nevermind half of what i just said....
>
> getbasename() does not change data. idk what I was looking at on my
> ipad when I wrote half of the msg. Well I had few versions of old
> toybox getdirname() and some random c library basename implementations
> on browser tabs open so mix up is just human error...
>
> strdup on else case is not needed, and therefore fix can be just
> simplified by replacing dirname only, so the minimal fix is just
>
>
> - char *s = FLAG(D) ? dirname(src) : getbasename(src);
> + char *s = FLAG(D) ? src : getbasename(src);
>
> this is probably something you liked to see... :)
Yay!
(It's not that what you wrote was necessarily _wrong_, I just wanted to think
through _why_ it was needed, because I wasn't understanding it. But shell
plumbing continues to eat my brain...)
Applied. Thanks,
Rob
More information about the Toybox
mailing list