* 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.
This commit is contained in:
Christopher Faylor 2001-04-11 19:09:53 +00:00
parent dd9752e88e
commit fc672fb26c
2 changed files with 25 additions and 7 deletions

View File

@ -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

View File

@ -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 ())
{