X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fmain.c;h=8b3212a4ede980fdc5044f6272a55b84823eaa21;hb=d7991738d65a2f27c174a7e6fdc3e70ec9b96aa5;hp=ce0b58f6e305aa5ff7ae17692efeec3a32894896;hpb=8e742d05cfba0f99d9958a0c10f5a884477e158a;p=wget diff --git a/src/main.c b/src/main.c index ce0b58f6..8b3212a4 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,7 @@ /* Command line parsing. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, + Inc. This file is part of GNU Wget. @@ -59,14 +60,23 @@ as that of the covered work. */ #include #include +#ifdef WINDOWS +# include +# include +#endif + #ifdef __VMS -#include "vms.h" +# include "vms.h" #endif /* __VMS */ #ifndef PATH_SEPARATOR # define PATH_SEPARATOR '/' #endif +#ifndef ENABLE_IRI +struct iri dummy_iri; +#endif + struct options opt; /* defined in version.c */ @@ -739,9 +749,9 @@ static char * prompt_for_password (void) { if (opt.user) - printf (_("Password for user %s: "), quote (opt.user)); + fprintf (stderr, _("Password for user %s: "), quote (opt.user)); else - printf (_("Password: ")); + fprintf (stderr, _("Password: ")); return getpass(""); } @@ -877,6 +887,8 @@ main (int argc, char **argv) int nurl; bool append_to_log = false; + total_downloaded_bytes = 0; + program_name = argv[0]; struct ptimer *timer = ptimer_new (); @@ -1060,6 +1072,14 @@ main (int argc, char **argv) /* All user options have now been processed, so it's now safe to do interoption dependency checks. */ + if (opt.noclobber && opt.convert_links) + { + fprintf (stderr, + _("Both --no-clobber and --convert-links were specified," + "only --convert-links will be used.\n")); + opt.noclobber = false; + } + if (opt.reclevel == 0) opt.reclevel = INFINITE_RECURSION; /* see recur.h for commentary */ @@ -1170,6 +1190,7 @@ for details.\n\n")); opt.encoding_remote = NULL; } #else + memset (&dummy_iri, 0, sizeof (dummy_iri)); if (opt.enable_iri || opt.locale || opt.encoding_remote) { /* sXXXav : be more specific... */ @@ -1233,14 +1254,7 @@ for details.\n\n")); if (HYPHENP (opt.output_document)) { #ifdef WINDOWS - FILE *result; - result = freopen ("CONOUT$", "wb", stdout); - if (result == NULL) - { - logputs (LOG_NOTQUIET, _("\ -WARNING: Can't reopen standard output in binary mode;\n\ - downloaded file may contain inappropriate line endings.\n")); - } + _setmode (_fileno (stdout), _O_BINARY); #endif output_stream = stdout; } @@ -1331,6 +1345,7 @@ outputting to a regular file.\n")); char *error = url_error (*t, url_err); logprintf (LOG_NOTQUIET, "%s: %s.\n",*t, error); xfree (error); + inform_exit_status (URLERROR); } else { @@ -1371,7 +1386,9 @@ outputting to a regular file.\n")); if (opt.input_filename) { int count; - retrieve_from_file (opt.input_filename, opt.force_html, &count); + int status; + status = retrieve_from_file (opt.input_filename, opt.force_html, &count); + inform_exit_status (status); if (!count) logprintf (LOG_NOTQUIET, _("No URLs found in %s.\n"), opt.input_filename);