From 924826a817e397c89509963a1d13d951c9d51ce5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 9 Feb 2017 20:25:59 -0500 Subject: bftw: Make the nameoff of "///" point to "/" This simplifies a few things such as -name handling for ///. --- bftw.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bftw.c') 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; } -- cgit v1.2.3