1 From 5985c61e19256d51f281d87e6610760663854b30 Mon Sep 17 00:00:00 2001
2 From: Kirill Smelkov <kirr@mns.spb.ru>
3 Date: Wed, 24 Nov 2010 21:27:58 +0300
4 Subject: [PATCH 3/4] Tech szBasename about '/' and '\\' path separators (win32 only)
6 Previously it was using '/' on linux and '\' on mingw. Since on windows
7 path separator can be on of those two, teach szBasename about it.
9 Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
11 misc.c | 11 ++++++-----
12 1 files changed, 6 insertions(+), 5 deletions(-)
14 diff --git a/misc.c b/misc.c
15 index 609a2f0..63d1c91 100644
18 @@ -519,7 +519,7 @@ unilen(const UCHAR *s)
20 szBasename(const char *szFilename)
25 fail(szFilename == NULL);
27 @@ -527,11 +527,12 @@ szBasename(const char *szFilename)
31 - szTmp = strrchr(szFilename, FILE_SEPARATOR[0]);
32 - if (szTmp == NULL) {
34 + /* check for both '/' and '\\' */
35 + for (tail = szFilename+strlen(szFilename)-1; tail >= szFilename; --tail) {
36 + if (*tail == '/' || *tail == '\\')
41 } /* end of szBasename */