summaryrefslogtreecommitdiffstats
path: root/bftw.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-02-09 20:25:59 -0500
committerTavian Barnes <tavianator@tavianator.com>2017-02-09 20:25:59 -0500
commit924826a817e397c89509963a1d13d951c9d51ce5 (patch)
treed9eb1cd82578c46ffed3a20897331dc82847437d /bftw.c
parent65af85882ae46cd8750b7f03519c3b291fc693db (diff)
downloadbfs-924826a817e397c89509963a1d13d951c9d51ce5.tar.xz
bftw: Make the nameoff of "///" point to "/"
This simplifies a few things such as -name handling for ///.
Diffstat (limited to 'bftw.c')
-rw-r--r--bftw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bftw.c b/bftw.c
index 5775d54..a3f3345 100644
--- a/bftw.c
+++ b/bftw.c
@@ -772,6 +772,9 @@ static size_t basename_offset(const char *path) {
// Find the beginning of the name
for (; i > 0 && path[i - 1] != '/'; --i);
+ // Strip leading slashes
+ for (; path[i] == '/' && path[i + 1]; ++i);
+
return i;
}