[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LYNX-DEV Patch for DOS
From: |
Klaus Weide |
Subject: |
Re: LYNX-DEV Patch for DOS |
Date: |
Tue, 7 Oct 1997 10:27:09 -0500 (CDT) |
On Sat, 4 Oct 1997, Doug Kaufman wrote:
> The substitution of $HOME for ~ in file URL's wasn't working in the DOS
> port. The following patch (against ac-0.73) fixes the problem.
>
> Doug
(I noted your later correction, it is in 2.7.1ac-0.76.)
There are other places where the DOSPATH code is
inconsistent. Sometimes the result of Home_Dir() is fed to
HTDOS_wwwName() before using it as part of a URL (as I assume it should),
and sometimes it isn't.
In LYUtils.c around line 3882:
} else
#endif /* DOSPATH */
if (*old_string == '~') {
/*
* On Unix, covert '~' to Home_Dir().
*/
StrAllocCat(*AllocatedString, Home_Dir());
if ((cp = strchr(old_string, '/')) != NULL) {
In LYUtils.c around line 4109:
} else if (old_string[1] == '~') {
/*
* Has a Home_Dir() reference. Handle it
* as if there weren't a lead slash. - FM
*/
#ifdef VMS
StrAllocCat(*AllocatedString, HTVMS_wwwName((char *)Home_Dir()));
#else
StrAllocCat(*AllocatedString, Home_Dir());
#endif /* VMS */
The StrAllocCat() in the followin stuff at the beginning of
LYConvertToURL looks suspicious:
#ifdef DOSPATH
{
char *cp_url = *AllocatedString;
for(; *cp_url != '\0'; cp_url++)
if(*cp_url == '\\') *cp_url = '/';
cp_url--;
if(*cp_url == ':')
StrAllocCat(*AllocatedString,"/");
/* ... */
}
#endif
Note that
StrAllocCat(*AllocatedString,"/");
(1) will leave old_string pointing to free()'d memory (which will be
referenced and later free()'d again),
and (2) it is immediately followed by
*AllocatedString = NULL; /* so StrAllocCopy doesn't free it */
StrAllocCopy(*AllocatedString,"file://localhost");
so there is no reference to the string resulting from
StrAllocCat(*AllocatedString,"/") (a memory leak, and it probably doesn't
have any effect).
I think repeating
cp_url = *AllocatedString;
before the *AllocatedString = NULL;
would fix it, but it still is confusing. Somebody should try the DOSPATH
code with that change.
By the way, HTDOS_wwwName has the following:
for ( ; *cp_url != '\0' ; cp_url++)
if(*cp_url == '\\') *cp_url = '/';
if(strlen(wwwname) > 3 && *cp_url == '/')
*cp_url = '\0';
It seems the last two lines can never have any effect, because after the
for loop cp_url will already point ot the terminating '\0' and not to the
last non-'\0' char.
Klaus
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;