mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 011a13463f7dbeafad0e168c365dcda291083cf4
parent e6dcea66ddd8e469a543145e9b449b990a450afb
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Tue, 11 Jul 2017 15:04:39 +0200

mlist: squeeze slashes from directory names

Closes #65.

Diffstat:
mlist.c | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/mlist.c b/mlist.c @@ -168,6 +168,19 @@ listdir(char *dir) void listarg(char *arg) { + char *s, *t; + + // squeeze slashes + s = t = arg; + while ((*s++ = *t)) + if (*t++ == '/') + while (*t == '/') + t++; + // remove trailing slashes + s--; + while (*--s == '/') + *s = 0; + struct stat st; if (stat(arg, &st) < 0) return;