diff options
author | Werner Koch <[email protected]> | 1999-02-10 16:22:40 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-02-10 16:22:40 +0000 |
commit | 9a4f506a18ed04f5dbd69d74ec0c35ade79e357a (patch) | |
tree | 07178f77cb23862b045b0edf8a2bc5ce188432cd /util/fileutil.c | |
parent | See ChangeLog: Sun Jan 24 18:16:26 CET 1999 Werner Koch (diff) | |
download | gnupg-9a4f506a18ed04f5dbd69d74ec0c35ade79e357a.tar.gz gnupg-9a4f506a18ed04f5dbd69d74ec0c35ade79e357a.zip |
See ChangeLog: Wed Feb 10 17:15:39 CET 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r-- | util/fileutil.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/util/fileutil.c b/util/fileutil.c index adf5c7a5d..7910631c2 100644 --- a/util/fileutil.c +++ b/util/fileutil.c @@ -38,16 +38,16 @@ char * make_basename(const char *filepath) { char *p; - + if ( !(p=strrchr(filepath, '/')) ) - #ifdef __MINGW32__ - if ( !(p=strrchr(filepath, '\\')) ) - if ( !(p=strrchr(filepath, ':')) ) + #ifdef HAVE_DRIVE_LETTERS + if ( !(p=strrchr(filepath, '\\')) ) + if ( !(p=strrchr(filepath, ':')) ) #endif - { - return m_strdup(filepath); - } - + { + return m_strdup(filepath); + } + return m_strdup(p+1); } @@ -65,21 +65,21 @@ make_dirname(const char *filepath) char *dirname; int dirname_length; char *p; - + if ( !(p=strrchr(filepath, '/')) ) - #ifdef __MINGW32__ - if ( !(p=strrchr(filepath, '\\')) ) - if ( !(p=strrchr(filepath, ':')) ) + #ifdef HAVE_DRIVE_LETTERS + if ( !(p=strrchr(filepath, '\\')) ) + if ( !(p=strrchr(filepath, ':')) ) #endif - { - return m_strdup("."); - } - + { + return m_strdup("."); + } + dirname_length = p-filepath; dirname = m_alloc(dirname_length+1); strncpy(dirname, filepath, dirname_length); dirname[dirname_length] = 0; - + return dirname; } @@ -126,7 +126,7 @@ compare_filenames( const char *a, const char *b ) /* ? check whether this is an absolute filename and * resolve symlinks? */ - #ifdef __MINGW32__ + #ifdef HAVE_DRIVE_LETTERS return stricmp(a,b); #else return strcmp(a,b); |