-/* If the string contains unsafe characters, duplicate it with
- encode_string, otherwise just copy it with strdup. */
-#define CLEANDUP(x) (contains_unsafe (x) ? encode_string (x) : xstrdup (x))
-
-/* Structure containing info on a URL. */
-struct urlinfo
-{
- char *url; /* Unchanged URL */
- uerr_t proto; /* URL protocol */
- char *host; /* Extracted hostname */
- unsigned short port;
- char ftp_type;
- char *path, *dir, *file; /* Path, as well as dir and file
- (properly decoded) */
- char *user, *passwd; /* Username and password */
- struct urlinfo *proxy; /* The exact string to pass to proxy
- server */
- char *referer; /* The source from which the request
- URI was obtained */
- char *local; /* The local filename of the URL
- document */
+/* Default port definitions */
+#define DEFAULT_HTTP_PORT 80
+#define DEFAULT_FTP_PORT 21
+#define DEFAULT_HTTPS_PORT 443
+
+/* This represents how many characters less than the OS max name length a file
+ * should be. More precisely, a file name should be at most
+ * (NAME_MAX - CHOMP_BUFFER) characters in length. This number was arrived at
+ * by adding the lengths of all possible strings that could be appended to a
+ * file name later in the code (e.g. ".orig", ".html", etc.). This is
+ * hopefully plenty of extra characters, but I am not guaranteeing that a file
+ * name will be of the proper length by the time the code wants to open a
+ * file descriptor. */
+#define CHOMP_BUFFER 19
+
+/* The flags that allow clobbering the file (opening with "wb").
+ Defined here to avoid repetition later. #### This will require
+ rework. */
+#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
+ || opt.dirstruct || opt.output_document || opt.backups > 0)
+
+/* Specifies how, or whether, user auth information should be included
+ * in URLs regenerated from URL parse structures. */
+enum url_auth_mode {
+ URL_AUTH_SHOW,
+ URL_AUTH_HIDE_PASSWD,
+ URL_AUTH_HIDE