#endif
#include <errno.h>
+#ifdef WINDOWS
+# include <winsock.h>
+#else
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+#endif
+
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#define CMD_DECLARE(func) static int func \
PARAMS ((const char *, const char *, void *))
+CMD_DECLARE (cmd_address);
CMD_DECLARE (cmd_boolean);
CMD_DECLARE (cmd_bytes);
CMD_DECLARE (cmd_directory_vector);
CMD_DECLARE (cmd_spec_header);
CMD_DECLARE (cmd_spec_htmlify);
CMD_DECLARE (cmd_spec_mirror);
-CMD_DECLARE (cmd_spec_outputdocument);
CMD_DECLARE (cmd_spec_recursive);
CMD_DECLARE (cmd_spec_useragent);
{ "background", &opt.background, cmd_boolean },
{ "backupconverted", &opt.backup_converted, cmd_boolean },
{ "backups", &opt.backups, cmd_number },
+ { "bindaddress", &opt.bind_address, cmd_address },
{ "base", &opt.base_href, cmd_string },
{ "cache", &opt.proxy_cache, cmd_boolean },
{ "continue", &opt.always_rest, cmd_boolean },
{ "noparent", &opt.no_parent, cmd_boolean },
{ "noproxy", &opt.no_proxy, cmd_vector },
{ "numtries", &opt.ntry, cmd_number_inf },/* deprecated*/
- { "outputdocument", NULL, cmd_spec_outputdocument },
+ { "outputdocument", &opt.output_document, cmd_string },
{ "pagerequisites", &opt.page_requisites, cmd_boolean },
{ "passiveftp", &opt.ftp_pasv, cmd_lockable_boolean },
{ "passwd", &opt.ftp_pass, cmd_string },
static int myatoi PARAMS ((const char *s));
+/* Store the address (specified as hostname or dotted-quad IP address) from VAL
+ to CLOSURE. COM is ignored, except for error messages. */
+static int
+cmd_address (const char *com, const char *val, void *closure)
+{
+ struct sockaddr_in *sin;
+
+ sin = (struct sockaddr_in *) malloc(sizeof *sin);
+ if (sin == NULL)
+ {
+ fprintf (stderr, _("%s: Out of memory.\n"), exec_name);
+ return 0;
+ }
+
+ if (!store_hostaddress ((unsigned char *)&sin->sin_addr, val))
+ {
+ fprintf (stderr, _("%s: %s: Cannot convert `%s' to an IP address.\n"),
+ exec_name, com, val);
+ return 0;
+ }
+
+ sin->sin_family = AF_INET;
+ sin->sin_port = 0;
+
+ * (struct sockaddr_in **) closure = sin;
+
+ return 1;
+}
+
/* Store the boolean value from VAL to CLOSURE. COM is ignored,
except for error messages. */
static int
return 1;
}
-static int
-cmd_spec_outputdocument (const char *com, const char *val, void *closure)
-{
- FREE_MAYBE (opt.output_document);
- opt.output_document = xstrdup (val);
- opt.ntry = 1;
- return 1;
-}
-
static int
cmd_spec_recursive (const char *com, const char *val, void *closure)
{