[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lynx-dev] Default file name when saving HTML documents to disk
From: |
Thomas Dickey |
Subject: |
Re: [Lynx-dev] Default file name when saving HTML documents to disk |
Date: |
Thu, 20 Apr 2006 11:05:18 -0400 |
User-agent: |
Mutt/1.3.27i |
On Thu, Apr 20, 2006 at 10:42:53AM -0400, Tunik Vlad-cvt002 wrote:
> I agree that the formed file name is legal. My question is why does Lynx
> append *.txt extension for *.html files and does not do this for *.cgi
> files? Does the user have control over it, or it is hidden in Lynx
> internals?
It's buried in lynx internals. The ".txt" extension for instance is added
by this chunk in src/LYPrint.c:
static void SetupFilename(char *filename,
const char *sug_filename)
{
HTFormat format;
HTAtom *encoding;
char *cp;
LYstrncpy(filename, sug_filename, LY_MAXPATH - 1); /* add suggestion info
*/
/* make the sug_filename conform to system specs */
change_sug_filename(filename);
if (!(HTisDocumentSource())
&& (cp = strrchr(filename, '.')) != NULL
&& (cp - filename) < LY_MAXPATH - 5) {
format = HTFileFormat(filename, &encoding, NULL);
if (!strcasecomp(format->name, "text/html") ||
!IsUnityEnc(encoding)) {
strcpy(cp, TEXT_SUFFIX);
}
}
}
The cgi script doesn't have a text/html format, so lynx leaves its name alone.
There is one known bug (your report reminded me of that, and reading the
code I see it): the function suggested_filename() in src/LYPrint.c should
also check for bzip2's suffixes ".bz2".
>
> Thanks.
>
> -----Original Message-----
> From: Thomas Dickey [mailto:address@hidden
> Sent: Wednesday, April 19, 2006 7:17 PM
> To: Tunik Vlad-cvt002
> Cc: address@hidden
> Subject: Re: [Lynx-dev] Default file name when saving HTML documents to
> disk
>
>
> On Wed, 19 Apr 2006, Tunik Vlad-cvt002 wrote:
>
> > Hello,
> >
> > When the 'P' (print) command is used Print Options screen is
> > displayed.
> > If 'Save to a local file' is selected the user is prompted to enter a
> > file name. The user is also presented with the default file name which
>
> > is formed differently depending on the document type. If the document
> is
> > <file_name>.html then the default file name is <file_name>.txt.
> However,
> > if the document is <file_name>.cgi then the default file name is the
> > same name as the document name: <file_name>.cgi. If the user decides
> to
> > use this default name they will overwrite the original .cgi script
> > making this particular HTML page unusable. Is this a known issue with
> > Lynx browser? Is there a way to control the default file name, or
> > perhaps not to display is at all?
>
> no - essentially all lynx does is edit the URL so that the corresponding
> filename is legal.
>
> --
> Thomas E. Dickey
> http://invisible-island.net
> ftp://invisible-island.net
>
>
> _______________________________________________
> Lynx-dev mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lynx-dev
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net