Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-04-11 23:09:53 +0400
committerChristopher Faylor <me@cgf.cx>2001-04-11 23:09:53 +0400
commitfc672fb26c42cc18eb0729236b221943d7bf25b3 (patch)
treebbce71fde4c40232124894c953cf25ff4b05a7f3 /winsup
parentdd9752e88e985b1ec7ec4a2cb4f3b276f5d35abb (diff)
* path.cc (struct symlink_info): Add extn and ext_tacked_on fields.
(path_conv::check): Only tack on extension if a known one didn't already exist. (suffix_scan::has): Return pointer to known extension. (symlink_info::check): Record location of extension, if any.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/path.cc24
2 files changed, 25 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 6bed3b02c..a68c2e77f 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+Tue Apr 10 22:02:53 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * path.cc (struct symlink_info): Add extn and ext_tacked_on fields.
+ (path_conv::check): Only tack on extension if a known one didn't
+ already exist.
+ (suffix_scan::has): Return pointer to known extension.
+ (symlink_info::check): Record location of extension, if any.
+
2001-04-09 Egor Duda <deo@logos-m.ru>
* fhandler.h (class fhandler_socket): Add members and methods to
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index ec14ea847..9d2f63d54 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -94,10 +94,12 @@ struct symlink_info
{
char buf[3 + MAX_PATH * 3];
char *ext_here;
+ int extn;
char *contents;
unsigned pflags;
DWORD fileattr;
int is_symlink;
+ bool ext_tacked_on;
int error;
symlink_info (): contents (buf + MAX_PATH + 1) {}
int check (const char *path, const suffix_info *suffixes);
@@ -377,10 +379,11 @@ path_conv::check (const char *src, unsigned opt,
}
fillin:
- if (sym.ext_here && !(opt & PC_SYM_CONTENTS))
+ if (sym.ext_here && *sym.ext_here && !(opt & PC_SYM_CONTENTS))
{
- known_suffix = strchr (this->path, '\0');
- strcpy (known_suffix, sym.ext_here);
+ known_suffix = this->path + sym.extn;
+ if (sym.ext_tacked_on)
+ strcpy (known_suffix, sym.ext_here);
}
out:
@@ -2467,8 +2470,11 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes)
suffixes = suffixes_start = in_suffixes;
char *ext_here = strrchr (in_path, '.');
+ path = in_path;
+ eopath = strchr (path, '\0');
+
if (!ext_here)
- goto done;
+ goto noext;
if (suffixes)
{
@@ -2489,10 +2495,11 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes)
suffixes = NULL;
}
+ noext:
+ ext_here = eopath;
+
done:
- path = in_path;
- eopath = strchr (path, '\0');
- return eopath;
+ return ext_here;
}
int
@@ -2574,6 +2581,9 @@ symlink_info::check (const char *path, const suffix_info *suffixes)
is_symlink = TRUE;
ext_here = suffix.has (path, suffixes);
+ extn = ext_here - path;
+
+ ext_tacked_on = !*ext_here;
while (suffix.next ())
{