diff options
author | LRN <lrn1986@gmail.com> | 2012-07-22 13:47:00 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2012-07-22 13:47:00 +0000 |
commit | 87ae074b51ba30501c60ff88782dc2ccd5ef0daa (patch) | |
tree | 6ad44daf1a1f7c8fc2c7f3f7e9a8369903428917 /src/transport/transport-testing.c | |
parent | 77328cb57ca1db081e7d6de95664d6bb400d26e1 (diff) | |
download | gnunet-87ae074b51ba30501c60ff88782dc2ccd5ef0daa.tar.gz gnunet-87ae074b51ba30501c60ff88782dc2ccd5ef0daa.zip |
DOS-pathsep-compatible filename extraction
Diffstat (limited to 'src/transport/transport-testing.c')
-rw-r--r-- | src/transport/transport-testing.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 87ce70423..8919aa555 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -611,7 +611,25 @@ extract_filename (const char *file) | |||
611 | char *backup = pch; | 611 | char *backup = pch; |
612 | char *filename = NULL; | 612 | char *filename = NULL; |
613 | char *res; | 613 | char *res; |
614 | 614 | #if WINDOWS | |
615 | if ((strlen (pch) >= 3) && pch[1] == ':') | ||
616 | { | ||
617 | if (NULL != strstr (pch, "\\")) | ||
618 | { | ||
619 | pch = strtok (pch, "\\"); | ||
620 | while (pch != NULL) | ||
621 | { | ||
622 | pch = strtok (NULL, "\\"); | ||
623 | if (pch != NULL) | ||
624 | filename = pch; | ||
625 | } | ||
626 | } | ||
627 | } | ||
628 | if (filename != NULL) | ||
629 | pch = filename; /* If we miss the next condition, filename = pch will | ||
630 | * not harm us. | ||
631 | */ | ||
632 | #endif | ||
615 | if (NULL != strstr (pch, "/")) | 633 | if (NULL != strstr (pch, "/")) |
616 | { | 634 | { |
617 | pch = strtok (pch, "/"); | 635 | pch = strtok (pch, "/"); |