X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fmain.c;h=4c1a70e2ecee982f919bde0d53220dba920ac404;hb=d905504a0af1f808ead87bf6877dafaf6ff6aef8;hp=1f3880fdf302f542947dfef6302532ef76a471a3;hpb=763229b67f0e823505ef5f6cf77d0a7bd5746dc6;p=wget
diff --git a/src/main.c b/src/main.c
index 1f3880fd..4c1a70e2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,11 +1,12 @@
/* Command line parsing.
- Copyright (C) 1996-2006 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Wget.
GNU Wget is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
GNU Wget is distributed in the hope that it will be useful,
@@ -14,8 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+along with Wget. If not, see .
In addition, as a special exception, the Free Software Foundation
gives permission to link the code of its release of Wget with the
@@ -36,7 +36,7 @@ so, delete this exception statement from your version. */
#endif /* HAVE_UNISTD_H */
#include
#include
-#ifdef HAVE_NLS
+#ifdef ENABLE_NLS
# include
#endif
#include
@@ -55,8 +55,7 @@ so, delete this exception statement from your version. */
#include "spider.h"
#include "http.h" /* for save_cookies */
-/* On GNU system this will include system-wide getopt.h. */
-#include "getopt.h"
+#include
#ifndef PATH_SEPARATOR
# define PATH_SEPARATOR '/'
@@ -72,6 +71,7 @@ static void redirect_output_signal (int);
const char *exec_name;
+#ifndef TESTING
/* Initialize I18N/L10N. That amounts to invoking setlocale, and
setting up gettext's message catalog using bindtextdomain and
textdomain. Does nothing if NLS is disabled or missing. */
@@ -79,14 +79,14 @@ const char *exec_name;
static void
i18n_initialize (void)
{
- /* HAVE_NLS implies existence of functions invoked here. */
-#ifdef HAVE_NLS
+ /* ENABLE_NLS implies existence of functions invoked here. */
+#ifdef ENABLE_NLS
/* Set the current locale. */
setlocale (LC_ALL, "");
/* Set the text message domain. */
bindtextdomain ("wget", LOCALEDIR);
textdomain ("wget");
-#endif /* HAVE_NLS */
+#endif /* ENABLE_NLS */
}
/* Definition of command-line options. */
@@ -190,6 +190,7 @@ static struct cmdline_option option_data[] =
{ "level", 'l', OPT_VALUE, "reclevel", -1 },
{ "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
{ "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
+ { "max-redirect", 0, OPT_VALUE, "maxredirect", -1 },
{ "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
{ "no", 'n', OPT__NO, NULL, required_argument },
{ "no-clobber", 0, OPT_BOOLEAN, "noclobber", -1 },
@@ -243,6 +244,9 @@ static struct cmdline_option option_data[] =
{ "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
{ "wait", 'w', OPT_VALUE, "wait", -1 },
{ "waitretry", 0, OPT_VALUE, "waitretry", -1 },
+#ifdef MSDOS
+ { "wdebug", 0, OPT_BOOLEAN, "wdebug", -1 },
+#endif
};
#undef WHEN_DEBUG
@@ -385,6 +389,10 @@ Logging and input file:\n"),
#ifdef ENABLE_DEBUG
N_("\
-d, --debug print lots of debugging information.\n"),
+#endif
+#ifdef MSDOS
+ N_("\
+ --wdebug print Watt-32 debug output.\n"),
#endif
N_("\
-q, --quiet quiet (no output).\n"),
@@ -497,6 +505,8 @@ HTTP options:\n"),
--ignore-length ignore `Content-Length' header field.\n"),
N_("\
--header=STRING insert STRING among the headers.\n"),
+ N_("\
+ --max-redirect maximum redirections allowed per page.\n"),
N_("\
--proxy-user=USER set USER as proxy username.\n"),
N_("\
@@ -664,20 +674,20 @@ print_version (void)
{
printf ("GNU Wget %s\n\n", version_string);
fputs (_("\
-Copyright (C) 2006 Free Software Foundation, Inc.\n"), stdout);
+Copyright (C) 2007 Free Software Foundation, Inc.\n"), stdout);
fputs (_("\
-This program is distributed in the hope that it will be useful,\n\
-but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
-GNU General Public License for more details.\n"), stdout);
+License GPLv3+: GNU GPL version 3 or later\n\
+.\n\
+This is free software: you are free to change and redistribute it.\n\
+There is NO WARRANTY, to the extent permitted by law.\n"), stdout);
fputs (_("\nOriginally written by Hrvoje Niksic .\n"),
stdout);
- fputs (_("\nCurrently maintained by Mauro Tortonesi .\n"),
+ fputs (_("Currently maintained by Micah Cowan .\n"),
stdout);
exit (0);
}
-#ifndef TESTING
+
int
main (int argc, char *const *argv)
{
@@ -697,7 +707,7 @@ main (int argc, char *const *argv)
#ifdef WINDOWS
/* Drop extension (typically .EXE) from executable filename. */
- windows_main (&argc, (char **) argv, (char **) &exec_name);
+ windows_main ((char **) &exec_name);
#endif
/* Set option defaults; read the system wgetrc and ~/.wgetrc. */
@@ -801,9 +811,9 @@ main (int argc, char *const *argv)
before passing the value to setoptval. */
bool flag = true;
if (optarg)
- flag = (*optarg == '1' || TOLOWER (*optarg) == 'y'
- || (TOLOWER (optarg[0]) == 'o'
- && TOLOWER (optarg[1]) == 'n'));
+ flag = (*optarg == '1' || c_tolower (*optarg) == 'y'
+ || (c_tolower (optarg[0]) == 'o'
+ && c_tolower (optarg[1]) == 'n'));
setoptval (opt->type == OPT__PARENT ? "noparent" : "noclobber",
flag ? "0" : "1", opt->long_name);
break;
@@ -822,7 +832,10 @@ main (int argc, char *const *argv)
interoption dependency checks. */
if (opt.reclevel == 0)
- opt.reclevel = INFINITE_RECURSION; /* see recur.h for commentary on this */
+ opt.reclevel = INFINITE_RECURSION; /* see recur.h for commentary */
+
+ if (opt.spider || opt.delete_after)
+ opt.no_dirstruct = true;
if (opt.page_requisites && !opt.recursive)
{
@@ -889,8 +902,14 @@ Can't timestamp and not clobber old files at the same time.\n"));
exit (1);
}
+#ifdef MSDOS
+ if (opt.wdebug)
+ dbug_init();
+ sock_init();
+#else
if (opt.background)
fork_to_background ();
+#endif
/* Initialize progress. Have to do this after the options are
processed so we know where the log file is. */
@@ -967,7 +986,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
int dt;
if ((opt.recursive || opt.page_requisites)
- && (url_scheme (*t) != SCHEME_FTP || opt.use_proxy))
+ && (url_scheme (*t) != SCHEME_FTP || url_uses_proxy (*t)))
{
int old_follow_ftp = opt.follow_ftp;
@@ -1019,7 +1038,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
{
logprintf (LOG_NOTQUIET,
_("FINISHED --%s--\nDownloaded: %d files, %s in %s (%s)\n"),
- time_str (time (NULL)),
+ datetime_str (time (NULL)),
opt.numurls,
human_readable (total_downloaded_bytes),
secs_to_human_time (total_download_time),