Mark msysGit as obsolete
[msysgit.git] / src / antiword / patches / 0003-Tech-szBasename-about-and-path-separators-win32-only.patch
blobe333e597c61b1dae55f1c977901d0df6fa0f20bc
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>
10 ---
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
16 --- a/misc.c
17 +++ b/misc.c
18 @@ -519,7 +519,7 @@ unilen(const UCHAR *s)
19 const char *
20 szBasename(const char *szFilename)
22 - const char *szTmp;
23 + const char *tail;
25 fail(szFilename == NULL);
27 @@ -527,11 +527,12 @@ szBasename(const char *szFilename)
28 return "null";
31 - szTmp = strrchr(szFilename, FILE_SEPARATOR[0]);
32 - if (szTmp == NULL) {
33 - return szFilename;
34 + /* check for both '/' and '\\' */
35 + for (tail = szFilename+strlen(szFilename)-1; tail >= szFilename; --tail) {
36 + if (*tail == '/' || *tail == '\\')
37 + return tail+1;
39 - return ++szTmp;
40 + return szFilename;
41 } /* end of szBasename */
44 --
45 1.7.3.2.245.g03276