From dc9abe478f8175d342f190993d0dc61891a7da8e Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Sun, 3 Aug 2008 22:12:34 -0700 Subject: [PATCH] jff: option for specifying the default page-name. --- ChangeLog | 5 +++++ NEWS | 3 +++ src/ChangeLog | 5 +++++ src/init.c | 1 + src/main.c | 1 + src/options.h | 2 ++ src/url.c | 8 +++++++- 7 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d96ce355..4bd9e3b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-01 Joao Ferreira + + * NEWS: Added option --default-page to support alternative + default names for index.html + 2008-06-30 Micah Cowan * NEWS: Entries for 1.11.4. diff --git a/NEWS b/NEWS index a5774794..7d15a98a 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ Please send GNU Wget bug reports to . * Changes in Wget 1.12 (MAINLINE) +** --default-page option added to support alternative default names for +index.html. + ** Added support for CSS. This includes: - Parsing links from CSS files, and from CSS content found in HTML style tags and attributes. diff --git a/src/ChangeLog b/src/ChangeLog index e1ee6082..0f4ec366 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-08-01 Joao Ferreira + + * 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 * build_info.c, css-url.c: #include wget.h, not config.h. diff --git a/src/init.c b/src/init.c index d4fc10e3..a774061b 100644 --- a/src/init.c +++ b/src/init.c @@ -140,6 +140,7 @@ static const struct { #ifdef ENABLE_DEBUG { "debug", &opt.debug, cmd_boolean }, #endif + { "defaultpage", &opt.default_page, cmd_string}, { "deleteafter", &opt.delete_after, cmd_boolean }, { "dirprefix", &opt.dir_prefix, cmd_directory }, { "dirstruct", NULL, cmd_spec_dirstruct }, diff --git a/src/main.c b/src/main.c index 70387c9c..277dd0e9 100644 --- a/src/main.c +++ b/src/main.c @@ -163,6 +163,7 @@ static struct cmdline_option option_data[] = { "cookies", 0, OPT_BOOLEAN, "cookies", -1 }, { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 }, { WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 }, + { "default-page", 0, OPT_VALUE, "defaultpage", -1 }, { "delete-after", 0, OPT_BOOLEAN, "deleteafter", -1 }, { "directories", 0, OPT_BOOLEAN, "dirstruct", -1 }, { "directory-prefix", 'P', OPT_VALUE, "dirprefix", -1 }, diff --git a/src/options.h b/src/options.h index 6a6badb0..ba39ec4e 100644 --- a/src/options.h +++ b/src/options.h @@ -59,6 +59,8 @@ struct options char *input_filename; /* Input filename */ 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? */ char **accepts; /* List of patterns to accept. */ diff --git a/src/url.c b/src/url.c index 5d9cd91f..3f4b8992 100644 --- a/src/url.c +++ b/src/url.c @@ -1448,11 +1448,17 @@ url_file_name (const struct url *u) const char *u_file, *u_query; char *fname, *unique; + char *index_filename = "index.html"; /* The default index file is index.html */ fnres.base = NULL; fnres.size = 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. */ if (opt.dir_prefix) append_string (opt.dir_prefix, &fnres); @@ -1494,7 +1500,7 @@ url_file_name (const struct url *u) /* Add the file name. */ if (fnres.tail) 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 "?query" to the file name. */ -- 2.39.2