]> sjero.net Git - wget/commitdiff
jff: option for specifying the default page-name.
authorMicah Cowan <micah@cowan.name>
Mon, 4 Aug 2008 05:12:34 +0000 (22:12 -0700)
committerMicah Cowan <micah@cowan.name>
Mon, 4 Aug 2008 05:12:34 +0000 (22:12 -0700)
ChangeLog
NEWS
src/ChangeLog
src/init.c
src/main.c
src/options.h
src/url.c

index d96ce3552e28057dadb989f4ae7ce26882d29f72..4bd9e3b3683aad2fe701e2c5ed3053fe5f0eaeb3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * NEWS: Entries for 1.11.4.
diff --git a/NEWS b/NEWS
index a57747942afb81491f837cc56f02ec479780c038..7d15a98af35f2c029a6faec8ac6b8f021c40ccdc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ Please send GNU Wget bug reports to <bug-wget@gnu.org>.
 \f
 * 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.
index e1ee60822bb9e8171862f8114b883bcb069c8a34..0f4ec3667cf7e236f6d77db68edf618fa8b7d105 100644 (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>
 
        * build_info.c, css-url.c: #include wget.h, not config.h.
index d4fc10e3b0f54a62930dec33f0fa3191ea2dc78d..a774061b413a4f1ecd1f98086b2ac4e14ae36238 100644 (file)
@@ -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 },
index 70387c9c5d6999fe38a3d9a582979e55f29ba641..277dd0e969e7ad85c327370952aa9d775e042b0f 100644 (file)
@@ -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 },
index 6a6badb0dab4d5f0e9ea9e5d1a4da70c43b8477d..ba39ec4e967d43c641caf2dfdeac8c112ddedc41 100644 (file)
@@ -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. */
index 5d9cd91f51d90ec0957aba9561a76ae273f8f11d..3f4b89920fd2f5d2b37956f3c6f05ba0086051af 100644 (file)
--- 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. */