summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-04-13 07:54:20 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-04-13 07:54:20 +0000
commite61cead397205b61dafed0d725cf9dcd89aead76 (patch)
tree23a491dd0a865793eb1e5cade64365f04bb7467b /winsup/cygwin/path.cc
parentcf620a691250ee28b2d74fce4c2f83acecf624f3 (diff)
downloadcygnal-e61cead397205b61dafed0d725cf9dcd89aead76.tar.gz
cygnal-e61cead397205b61dafed0d725cf9dcd89aead76.tar.bz2
cygnal-e61cead397205b61dafed0d725cf9dcd89aead76.zip
* path.cc (add_ext_from_sym): New define evaluating `known'suffix'.
(path_conv::check): Use add_ext_from_sym throughout.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc27
1 files changed, 9 insertions, 18 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 3193c7a98..be165a046 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -179,6 +179,11 @@ pathmatch (const char *path1, const char *path2)
: strcasematch (path1, path2);
}
+#define add_ext_from_sym(sym) \
+ (void)(sym.ext_here && *sym.ext_here && \
+ ( known_suffix = this->path + sym.extn, \
+ (sym.ext_tacked_on && strcpy (known_suffix, sym.ext_here))))
+
/* Convert an arbitrary path SRC to a pure Win32 path, suitable for
passing to Win32 API routines.
@@ -331,12 +336,7 @@ path_conv::check (const char *src, unsigned opt,
if (component == 0)
{
fileattr = sym.fileattr;
- if (sym.ext_here && *sym.ext_here)
- {
- known_suffix = this->path + sym.extn;
- if (sym.ext_tacked_on)
- strcpy (known_suffix, sym.ext_here);
- }
+ add_ext_from_sym (sym);
}
if (pcheck_case == PCHECK_RELAXED)
goto out; // file found
@@ -361,12 +361,7 @@ path_conv::check (const char *src, unsigned opt,
strcpy (path, sym.contents);
goto out;
}
- if (sym.ext_here && *sym.ext_here)
- {
- known_suffix = this->path + sym.extn;
- if (sym.ext_tacked_on)
- strcpy (known_suffix, sym.ext_here);
- }
+ add_ext_from_sym (sym);
if (pcheck_case == PCHECK_RELAXED)
goto out;
/* Avoid further symlink evaluation. Only case checks are
@@ -436,12 +431,8 @@ path_conv::check (const char *src, unsigned opt,
}
/*fillin:*/
- if (sym.ext_here && *sym.ext_here && !(opt & PC_SYM_CONTENTS))
- {
- known_suffix = this->path + sym.extn;
- if (sym.ext_tacked_on)
- strcpy (known_suffix, sym.ext_here);
- }
+ if (!(opt & PC_SYM_CONTENTS))
+ add_ext_from_sym (sym);
out:
/* Deal with Windows stupidity which considers filename\. to be valid