* 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:
parent
dd9752e88e
commit
fc672fb26c
@ -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>
|
2001-04-09 Egor Duda <deo@logos-m.ru>
|
||||||
|
|
||||||
* fhandler.h (class fhandler_socket): Add members and methods to
|
* fhandler.h (class fhandler_socket): Add members and methods to
|
||||||
|
@ -94,10 +94,12 @@ struct symlink_info
|
|||||||
{
|
{
|
||||||
char buf[3 + MAX_PATH * 3];
|
char buf[3 + MAX_PATH * 3];
|
||||||
char *ext_here;
|
char *ext_here;
|
||||||
|
int extn;
|
||||||
char *contents;
|
char *contents;
|
||||||
unsigned pflags;
|
unsigned pflags;
|
||||||
DWORD fileattr;
|
DWORD fileattr;
|
||||||
int is_symlink;
|
int is_symlink;
|
||||||
|
bool ext_tacked_on;
|
||||||
int error;
|
int error;
|
||||||
symlink_info (): contents (buf + MAX_PATH + 1) {}
|
symlink_info (): contents (buf + MAX_PATH + 1) {}
|
||||||
int check (const char *path, const suffix_info *suffixes);
|
int check (const char *path, const suffix_info *suffixes);
|
||||||
@ -377,10 +379,11 @@ path_conv::check (const char *src, unsigned opt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fillin:
|
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');
|
known_suffix = this->path + sym.extn;
|
||||||
strcpy (known_suffix, sym.ext_here);
|
if (sym.ext_tacked_on)
|
||||||
|
strcpy (known_suffix, sym.ext_here);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@ -2467,8 +2470,11 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes)
|
|||||||
suffixes = suffixes_start = in_suffixes;
|
suffixes = suffixes_start = in_suffixes;
|
||||||
|
|
||||||
char *ext_here = strrchr (in_path, '.');
|
char *ext_here = strrchr (in_path, '.');
|
||||||
|
path = in_path;
|
||||||
|
eopath = strchr (path, '\0');
|
||||||
|
|
||||||
if (!ext_here)
|
if (!ext_here)
|
||||||
goto done;
|
goto noext;
|
||||||
|
|
||||||
if (suffixes)
|
if (suffixes)
|
||||||
{
|
{
|
||||||
@ -2489,10 +2495,11 @@ suffix_scan::has (const char *in_path, const suffix_info *in_suffixes)
|
|||||||
suffixes = NULL;
|
suffixes = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noext:
|
||||||
|
ext_here = eopath;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
path = in_path;
|
return ext_here;
|
||||||
eopath = strchr (path, '\0');
|
|
||||||
return eopath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -2574,6 +2581,9 @@ symlink_info::check (const char *path, const suffix_info *suffixes)
|
|||||||
|
|
||||||
is_symlink = TRUE;
|
is_symlink = TRUE;
|
||||||
ext_here = suffix.has (path, suffixes);
|
ext_here = suffix.has (path, suffixes);
|
||||||
|
extn = ext_here - path;
|
||||||
|
|
||||||
|
ext_tacked_on = !*ext_here;
|
||||||
|
|
||||||
while (suffix.next ())
|
while (suffix.next ())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user