Mercurial > hg > toybox
changeset 500:cd70270dbc51
Teach patch -p that consecutive /// counts as one path component.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 26 Feb 2012 21:52:07 -0600 |
parents | bc4615e2e339 |
children | 8abb9e307d0c |
files | toys/patch.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/patch.c Sun Feb 26 16:11:25 2012 -0600 +++ b/toys/patch.c Sun Feb 26 21:52:07 2012 -0600 @@ -354,12 +354,12 @@ } // handle -p path truncation. - for (i=0, s = name; *s;) { + for (i = 0, s = name; *s;) { if ((toys.optflags & FLAG_PATHLEN) && TT.prefix == i) break; - if (*(s++)=='/') { - name = s; - i++; - } + if (*s++ != '/') continue; + while (*s == '/') s++; + name = s; + i++; } if (del) {