1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

jff: option for specifying the default page-name.

This commit is contained in:
Micah Cowan 2008-08-03 22:12:34 -07:00
parent 90a2d106cd
commit dc9abe478f
7 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-08-01 Joao Ferreira <joao@joaoff.com>
* NEWS: Added option --default-page to support alternative
default names for index.html
2008-06-30 Micah Cowan <micah@cowan.name> 2008-06-30 Micah Cowan <micah@cowan.name>
* NEWS: Entries for 1.11.4. * NEWS: Entries for 1.11.4.

3
NEWS
View File

@ -8,6 +8,9 @@ Please send GNU Wget bug reports to <bug-wget@gnu.org>.
* Changes in Wget 1.12 (MAINLINE) * Changes in Wget 1.12 (MAINLINE)
** --default-page option added to support alternative default names for
index.html.
** Added support for CSS. This includes: ** Added support for CSS. This includes:
- Parsing links from CSS files, and from CSS content found in HTML - Parsing links from CSS files, and from CSS content found in HTML
style tags and attributes. style tags and attributes.

View File

@ -1,3 +1,8 @@
2008-08-01 Joao Ferreira <joao@joaoff.com>
* init.c, main.c, options.h, url.c: Added option --default-page
to support alternative default names for index.html
2008-08-03 Micah Cowan <micah@cowan.name> 2008-08-03 Micah Cowan <micah@cowan.name>
* build_info.c, css-url.c: #include wget.h, not config.h. * build_info.c, css-url.c: #include wget.h, not config.h.

View File

@ -140,6 +140,7 @@ static const struct {
#ifdef ENABLE_DEBUG #ifdef ENABLE_DEBUG
{ "debug", &opt.debug, cmd_boolean }, { "debug", &opt.debug, cmd_boolean },
#endif #endif
{ "defaultpage", &opt.default_page, cmd_string},
{ "deleteafter", &opt.delete_after, cmd_boolean }, { "deleteafter", &opt.delete_after, cmd_boolean },
{ "dirprefix", &opt.dir_prefix, cmd_directory }, { "dirprefix", &opt.dir_prefix, cmd_directory },
{ "dirstruct", NULL, cmd_spec_dirstruct }, { "dirstruct", NULL, cmd_spec_dirstruct },

View File

@ -163,6 +163,7 @@ static struct cmdline_option option_data[] =
{ "cookies", 0, OPT_BOOLEAN, "cookies", -1 }, { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
{ "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 }, { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
{ WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 }, { WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
{ "default-page", 0, OPT_VALUE, "defaultpage", -1 },
{ "delete-after", 0, OPT_BOOLEAN, "deleteafter", -1 }, { "delete-after", 0, OPT_BOOLEAN, "deleteafter", -1 },
{ "directories", 0, OPT_BOOLEAN, "dirstruct", -1 }, { "directories", 0, OPT_BOOLEAN, "dirstruct", -1 },
{ "directory-prefix", 'P', OPT_VALUE, "dirprefix", -1 }, { "directory-prefix", 'P', OPT_VALUE, "dirprefix", -1 },

View File

@ -59,6 +59,8 @@ struct options
char *input_filename; /* Input filename */ char *input_filename; /* Input filename */
bool force_html; /* Is the input file an HTML file? */ bool force_html; /* Is the input file an HTML file? */
char *default_page; /* Alternative default page (index file) */
bool spider; /* Is Wget in spider mode? */ bool spider; /* Is Wget in spider mode? */
char **accepts; /* List of patterns to accept. */ char **accepts; /* List of patterns to accept. */

View File

@ -1448,11 +1448,17 @@ url_file_name (const struct url *u)
const char *u_file, *u_query; const char *u_file, *u_query;
char *fname, *unique; char *fname, *unique;
char *index_filename = "index.html"; /* The default index file is index.html */
fnres.base = NULL; fnres.base = NULL;
fnres.size = 0; fnres.size = 0;
fnres.tail = 0; fnres.tail = 0;
/* If an alternative index file was defined, change index_filename */
if (opt.default_page)
index_filename = opt.default_page;
/* Start with the directory prefix, if specified. */ /* Start with the directory prefix, if specified. */
if (opt.dir_prefix) if (opt.dir_prefix)
append_string (opt.dir_prefix, &fnres); append_string (opt.dir_prefix, &fnres);
@ -1494,7 +1500,7 @@ url_file_name (const struct url *u)
/* Add the file name. */ /* Add the file name. */
if (fnres.tail) if (fnres.tail)
append_char ('/', &fnres); append_char ('/', &fnres);
u_file = *u->file ? u->file : "index.html"; u_file = *u->file ? u->file : index_filename;
append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres); append_uri_pathel (u_file, u_file + strlen (u_file), false, &fnres);
/* Append "?query" to the file name. */ /* Append "?query" to the file name. */