/* 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.
#include <getpass.h>
#include <quote.h>
+#ifdef WINDOWS
+# include <io.h>
+# include <fcntl.h>
+#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 */
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("");
}
int nurl;
bool append_to_log = false;
+ total_downloaded_bytes = 0;
+
program_name = argv[0];
struct ptimer *timer = ptimer_new ();
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... */
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;
}
char *error = url_error (*t, url_err);
logprintf (LOG_NOTQUIET, "%s: %s.\n",*t, error);
xfree (error);
+ inform_exit_status (URLERROR);
}
else
{
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);