1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Allow --header to contain ",".

This commit is contained in:
hniksic 2005-05-30 06:31:24 -07:00
parent 082d2a5ab7
commit 0840de6605
4 changed files with 45 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2005-05-30 Hrvoje Niksic <hniksic@xemacs.org>
* init.c (cmd_spec_header): Don't split the string along the
commas using cmd_vector; just append the new value using
vec_append instead.
* utils.c (vec_append): New function.
2005-05-27 Andreas Beckmann <debian@abeckmann.de>
* html-url.c (tag_handle_link): Mark the content from the <link

View File

@ -162,7 +162,7 @@ static struct {
{ "ftpproxy", &opt.ftp_proxy, cmd_string },
{ "ftpuser", &opt.ftp_user, cmd_string },
{ "glob", &opt.ftp_glob, cmd_boolean },
{ "header", &opt.user_headers, cmd_spec_header },
{ "header", NULL, cmd_spec_header },
{ "htmlextension", &opt.html_extension, cmd_boolean },
{ "htmlify", NULL, cmd_spec_htmlify },
{ "httpkeepalive", &opt.http_keep_alive, cmd_boolean },
@ -1118,15 +1118,24 @@ cmd_spec_dirstruct (const char *com, const char *val, void *place_ignored)
}
static int
cmd_spec_header (const char *com, const char *val, void *place)
cmd_spec_header (const char *com, const char *val, void *place_ignored)
{
/* Empty value means reset the list of headers. */
if (*val == '\0')
{
free_vec (opt.user_headers);
opt.user_headers = NULL;
return 1;
}
if (!check_user_specified_header (val))
{
fprintf (stderr, _("%s: %s: Invalid header `%s'.\n"),
exec_name, com, val);
return 0;
}
return cmd_vector (com, val, place);
opt.user_headers = vec_append (opt.user_headers, val);
return 1;
}
static int

View File

@ -1085,6 +1085,30 @@ merge_vecs (char **v1, char **v2)
xfree (v2);
return v1;
}
/* Append a freshly allocated copy of STR to VEC. If VEC is NULL, it
is allocated as needed. Return the new value of the vector. */
char **
vec_append (char **vec, const char *str)
{
int cnt; /* count of vector elements, including
the one we're about to append */
if (vec != NULL)
{
for (cnt = 0; vec[cnt]; cnt++)
;
++cnt;
}
else
cnt = 1;
/* Reallocate the array to fit the new element and the NULL. */
vec = xrealloc (vec, (cnt + 1) * sizeof (char *));
/* Append a copy of STR to the vector. */
vec[cnt - 1] = xstrdup (str);
vec[cnt] = NULL;
return vec;
}
/* Sometimes it's useful to create "sets" of strings, i.e. special
hash tables where you want to store strings as keys and merely

View File

@ -92,6 +92,7 @@ void read_file_free PARAMS ((struct file_memory *));
void free_vec PARAMS ((char **));
char **merge_vecs PARAMS ((char **, char **));
char **vec_append PARAMS ((char **, const char *));
void string_set_add PARAMS ((struct hash_table *, const char *));
int string_set_contains PARAMS ((struct hash_table *, const char *));