#include "netrc.h"
#include "cookies.h" /* for cookie_jar_delete */
#include "progress.h"
+#include "recur.h" /* for INFINITE_RECURSION */
#ifndef errno
extern int errno;
NULL this way is technically illegal, but porting Wget to a
machine where NULL is not all-zero bit pattern will be the least
of the implementors' worries. */
- memset (&opt, 0, sizeof (opt));
+ xzero (opt);
opt.cookies = 1;
-
opt.verbose = -1;
opt.ntry = 20;
opt.reclevel = 5;
file = (char *)xmalloc (strlen (home) + 1 + strlen (".wgetrc") + 1);
sprintf (file, "%s/.wgetrc", home);
}
- FREE_MAYBE (home);
+ xfree_null (home);
#else /* WINDOWS */
/* Under Windows, "home" is (for the purposes of this function) the
directory where `wget.exe' resides, and `wget.ini' will be used
/* Run command COM with value VAL. If running the command produces an
error, report the error and exit.
- This is intended to be called from main() with commands not
- provided by the user, therefore it aborts when an unknown command
- is encountered. Once the COMIND's are exported to init.h, this
- function will be changed to accept COMIND directly. */
+ This is intended to be called from main() to modify Wget's behavior
+ through command-line switches. Since COM is hard-coded in main(),
+ it is not canonicalized, and this aborts when COM is not found.
+
+ If COMIND's are exported to init.h, this function will be changed
+ to accept COMIND directly. */
void
setoptval (const char *com, const char *val)
{
char **pstring = (char **)closure;
- FREE_MAYBE (*pstring);
+ xfree_null (*pstring);
*pstring = xstrdup (val);
return 1;
}
{
char **pstring = (char **)closure;
- FREE_MAYBE (*pstring);
+ xfree_null (*pstring);
/* #### If VAL is empty, perhaps should set *CLOSURE to NULL. */
if (!*val)
{
/* Empty header means reset headers. */
- FREE_MAYBE (opt.user_header);
+ xfree_null (opt.user_header);
opt.user_header = NULL;
}
else
exec_name, com, val);
return 0;
}
- FREE_MAYBE (opt.progress_type);
+ xfree_null (opt.progress_type);
/* Don't call set_progress_implementation here. It will be called
in main() when it becomes clear what the log output is. */
extern acc_t *netrc_list;
free_netrc (netrc_list);
}
- FREE_MAYBE (opt.lfilename);
- FREE_MAYBE (opt.dir_prefix);
- FREE_MAYBE (opt.input_filename);
- FREE_MAYBE (opt.output_document);
+ xfree_null (opt.lfilename);
+ xfree_null (opt.dir_prefix);
+ xfree_null (opt.input_filename);
+ xfree_null (opt.output_document);
free_vec (opt.accepts);
free_vec (opt.rejects);
free_vec (opt.excludes);
free_vec (opt.domains);
free_vec (opt.follow_tags);
free_vec (opt.ignore_tags);
- FREE_MAYBE (opt.progress_type);
+ xfree_null (opt.progress_type);
xfree (opt.ftp_acc);
- FREE_MAYBE (opt.ftp_pass);
- FREE_MAYBE (opt.ftp_proxy);
- FREE_MAYBE (opt.https_proxy);
- FREE_MAYBE (opt.http_proxy);
+ xfree_null (opt.ftp_pass);
+ xfree_null (opt.ftp_proxy);
+ xfree_null (opt.https_proxy);
+ xfree_null (opt.http_proxy);
free_vec (opt.no_proxy);
- FREE_MAYBE (opt.useragent);
- FREE_MAYBE (opt.referer);
- FREE_MAYBE (opt.http_user);
- FREE_MAYBE (opt.http_passwd);
- FREE_MAYBE (opt.user_header);
+ xfree_null (opt.useragent);
+ xfree_null (opt.referer);
+ xfree_null (opt.http_user);
+ xfree_null (opt.http_passwd);
+ xfree_null (opt.user_header);
#ifdef HAVE_SSL
- FREE_MAYBE (opt.sslcertkey);
- FREE_MAYBE (opt.sslcertfile);
+ xfree_null (opt.sslcertkey);
+ xfree_null (opt.sslcertfile);
#endif /* HAVE_SSL */
- FREE_MAYBE (opt.bind_address);
- FREE_MAYBE (opt.cookies_input);
- FREE_MAYBE (opt.cookies_output);
+ xfree_null (opt.bind_address);
+ xfree_null (opt.cookies_input);
+ xfree_null (opt.cookies_output);
#endif
}