/* Command line parsing.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005 Free Software Foundation, Inc.
This file is part of GNU Wget.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
In addition, as a special exception, the Free Software Foundation
gives permission to link the code of its release of Wget with the
#endif /* HAVE_UNISTD_H */
#include <string.h>
#include <signal.h>
-#if defined(HAVE_NLS) && defined(HAVE_LOCALE_H)
+#ifdef HAVE_NLS
# include <locale.h>
#endif
#include <assert.h>
#include "url.h"
#include "progress.h" /* for progress_handle_sigwinch */
#include "convert.h"
+#include "http.h" /* for save_cookies */
/* On GNU system this will include system-wide getopt.h. */
#include "getopt.h"
extern char *version_string;
-extern struct cookie_jar *wget_cookie_jar;
-
+#if defined(SIGHUP) || defined(SIGUSR1)
static void redirect_output_signal (int);
+#endif
const char *exec_name;
\f
int argtype; /* for non-standard options */
};
-struct cmdline_option option_data[] =
+static struct cmdline_option option_data[] =
{
{ "accept", 'A', OPT_VALUE, "accept", -1 },
{ "append-output", 'a', OPT__APPEND_OUTPUT, NULL, required_argument },
N_("\
-K, --backup-converted before converting file X, back up as X.orig.\n"),
N_("\
- -m, --mirror shortcut option equivalent to -r -N -l inf -nr.\n"),
+ -m, --mirror shortcut for -N -r -l inf --no-remove-listing.\n"),
N_("\
-p, --page-requisites get all images, etc. needed to display HTML page.\n"),
N_("\
sprintf (buf, "%dh %dm %ds", hours, mins, secs);
else if (mins)
sprintf (buf, "%dm %ds", mins, secs);
- else if (interval >= 10)
- sprintf (buf, "%ds", secs);
else
- /* For very quick downloads show more exact timing information. */
- sprintf (buf, "%.*fs",
- interval < 0.001 ? 0 : /* 0s instead of 0.000s */
- interval < 0.01 ? 3 : /* 0.00x */
- interval < 0.1 ? 2 : /* 0.0x */
- 1, /* 0.x, 1.x, ..., 9.x */
- interval);
+ sprintf (buf, "%ss", print_decimal (interval));
return buf;
}
/* Open the output filename if necessary. */
if (opt.output_document)
{
- extern FILE *output_stream;
- extern bool output_stream_regular;
-
if (HYPHENP (opt.output_document))
output_stream = stdout;
else
time_str (NULL),
opt.numurls,
human_readable (total_downloaded_bytes),
- secs_to_human_time (total_download_time / 1000),
+ secs_to_human_time (total_download_time),
retr_rate (total_downloaded_bytes, total_download_time));
/* Print quota warning, if exceeded. */
if (opt.quota && total_downloaded_bytes > opt.quota)
}
\f
#if defined(SIGHUP) || defined(SIGUSR1)
+
+/* So the signal_name check doesn't blow when only one is available. */
+#ifndef SIGHUP
+# define SIGHUP -1
+#endif
+#ifndef SIGUSR1
+# define SIGUSR1 -1
+#endif
+
/* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it
will proceed operation as usual, trying to write into a log file.
If that is impossible, the output will be turned off. */