diff options
author | Stef Walter <stefw@redhat.com> | 2013-04-03 10:50:59 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-04-03 12:45:43 +0200 |
commit | a63311a0f3f2669138d09ff8f618fd4d12fa0c3d (patch) | |
tree | d5a9b8cd32dda2e0e1eff1a8393b5dcb2174f86b /common/compat.c | |
parent | c3f1b0a45eb1c28b6f025f8ae56c3b020801b6aa (diff) | |
download | p11-kit-a63311a0f3f2669138d09ff8f618fd4d12fa0c3d.tar.gz |
More compatible path munging and handling code
Centralize the path handling code, so we can remove unixy assumptions
and have a chance of running on Windows. The current goal is to run
all the tests on Windows.
Includes some code from LRN <lrn1986@gmail.com>
https://bugs.freedesktop.org/show_bug.cgi?id=63062
Diffstat (limited to 'common/compat.c')
-rw-r--r-- | common/compat.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/common/compat.c b/common/compat.c index 2cda460..4d8d73c 100644 --- a/common/compat.c +++ b/common/compat.c @@ -148,40 +148,6 @@ getprogname (void) #endif /* HAVE_GETPROGNAME */ -char * -p11_basename (const char *name) -{ -#ifdef OS_WIN32 - static const char *delims = "/\\"; -#else - static const char *delims = "/"; -#endif - - const char *end; - const char *beg; - - if (name == NULL) - return NULL; - - /* Any trailing slashes */ - end = name + strlen (name); - while (end != name) { - if (!strchr (delims, *(end - 1))) - break; - end--; - } - - /* Find the last slash after those */ - beg = end; - while (beg != name) { - if (strchr (delims, *(beg - 1))) - break; - beg--; - } - - return strndup (beg, end - beg); -} - #ifdef OS_UNIX #include <sys/stat.h> #include <sys/mman.h> |