diff options
author | Rob Landley <rob@landley.net> | 2012-02-26 21:52:07 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-02-26 21:52:07 -0600 |
commit | d73c956d902fcef15ba5f8cda9becd431f042a07 (patch) | |
tree | 94f6333533615bbdc0d7e983420c3f3788aab849 | |
parent | b081ce98999111aa5518388ed7eb8e5ceb5629f9 (diff) | |
download | toybox-d73c956d902fcef15ba5f8cda9becd431f042a07.tar.gz |
Teach patch -p that consecutive /// counts as one path component.
-rw-r--r-- | toys/patch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/patch.c b/toys/patch.c index 851f4eb6..38c71941 100644 --- a/toys/patch.c +++ b/toys/patch.c @@ -354,12 +354,12 @@ void patch_main(void) } // 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) { |