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 diff
     1.1 --- a/toys/patch.c	Sun Feb 26 16:11:25 2012 -0600
     1.2 +++ b/toys/patch.c	Sun Feb 26 21:52:07 2012 -0600
     1.3 @@ -354,12 +354,12 @@
     1.4  				}
     1.5  
     1.6  				// handle -p path truncation.
     1.7 -				for (i=0, s = name; *s;) {
     1.8 +				for (i = 0, s = name; *s;) {
     1.9  					if ((toys.optflags & FLAG_PATHLEN) && TT.prefix == i) break;
    1.10 -					if (*(s++)=='/') {
    1.11 -						name = s;
    1.12 -						i++;
    1.13 -					}
    1.14 +					if (*s++ != '/') continue;
    1.15 +					while (*s == '/') s++;
    1.16 +					name = s;
    1.17 +					i++;
    1.18  				}
    1.19  
    1.20  				if (del) {