On 3/13/13 5:17 PM, Matthew Riley wrote:
> ...
> nlen = nend - ntail;
> memcpy (nbeg, ntail, nlen);
> nbeg[nlen] = '\0';
>
> return name;
> ...
>
> [nbeg, nbeg+nlen) and [ntail, ntail+nlen) can overlap, so this code should
> use memmove. I'm pretty sure this explains why sometimes using
> PROMPT_DIRTRIM will give me a prompt with the last few components smeared
> over the rest of the string:
Good catch. Thanks for the report.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/