aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2012-07-22 13:47:00 +0000
committerLRN <lrn1986@gmail.com>2012-07-22 13:47:00 +0000
commit87ae074b51ba30501c60ff88782dc2ccd5ef0daa (patch)
tree6ad44daf1a1f7c8fc2c7f3f7e9a8369903428917
parent77328cb57ca1db081e7d6de95664d6bb400d26e1 (diff)
DOS-pathsep-compatible filename extraction
-rw-r--r--src/transport/transport-testing.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c
index 87ce704232..8919aa5550 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -611,7 +611,25 @@ extract_filename (const char *file)
char *backup = pch;
char *filename = NULL;
char *res;
-
+#if WINDOWS
+ if ((strlen (pch) >= 3) && pch[1] == ':')
+ {
+ if (NULL != strstr (pch, "\\"))
+ {
+ pch = strtok (pch, "\\");
+ while (pch != NULL)
+ {
+ pch = strtok (NULL, "\\");
+ if (pch != NULL)
+ filename = pch;
+ }
+ }
+ }
+ if (filename != NULL)
+ pch = filename; /* If we miss the next condition, filename = pch will
+ * not harm us.
+ */
+#endif
if (NULL != strstr (pch, "/"))
{
pch = strtok (pch, "/");