mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fix some problems under VMS.
This commit is contained in:
parent
e0a3162893
commit
8c7bd588fe
@ -1,3 +1,28 @@
|
|||||||
|
2011-10-07 Steven Schweda <address@hidden>
|
||||||
|
|
||||||
|
* connect.c: Add HAVE_SYS_SELECT_H and HAVE_SYS_SOCKET_H conditions
|
||||||
|
on includes of <sys/select.h> and <sys/socket.h>, respectively.
|
||||||
|
* ftp.c (getftp): Move BIN_TYPE_TRANSFER macro into VMS-specific
|
||||||
|
section. On VMS, use Stream_LF attributes for listing files. Pass
|
||||||
|
BIN_TYPE_FILE to fopen_excl() instead of constant-everywhere "true".
|
||||||
|
* ftp.c (ftp_retrieve_list): Restore lost test of opt.preserve_perm
|
||||||
|
(--preserve-permissions) on the chmod() operation.
|
||||||
|
* init.c, main.c: Remove "deprecated" from opt.preserve_perm
|
||||||
|
(--preserve-permissions).
|
||||||
|
* init.c (initialize): Use distinct messages for errors in C macro
|
||||||
|
SYSTEM_WGETRC and environment-variable SYSTEM_WGETRC. Avoid use of
|
||||||
|
C macro SYSTEM_WGETRC when it's not defined.
|
||||||
|
* log.c (log_close): Avoid closing logfp when it's stderr.
|
||||||
|
* main.c (print_help): Restore --preserve-permissions.
|
||||||
|
* main.c (main): Avoid using a negative value of longindex as a
|
||||||
|
subscript (for long_options[]) when searching for "--config".
|
||||||
|
* main.c (main): Exit the program using exit() instead of "return".
|
||||||
|
(VMS handles these differently, and exit() is better.)
|
||||||
|
* openssl.c (ssl_init): Add type cast (SSL_METHOD *) to newly "const"
|
||||||
|
"meth" argument to accommodate OpenSSL version 0.9.8, where that
|
||||||
|
argument is not "const" in the OpenSSL function (SSL_CTX_new).
|
||||||
|
* utils.c (fopen_excl): Comment typography.
|
||||||
|
|
||||||
2011-10-02 Henrik Holst <henrik.holst@millistream.com> (tiny change)
|
2011-10-02 Henrik Holst <henrik.holst@millistream.com> (tiny change)
|
||||||
* http.c (gethttp): If 'contentonerror' is used then do not
|
* http.c (gethttp): If 'contentonerror' is used then do not
|
||||||
skip the http body on 4xx and 5xx errors.
|
skip the http body on 4xx and 5xx errors.
|
||||||
|
@ -36,8 +36,13 @@ as that of the covered work. */
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <sys/select.h>
|
# include <sys/socket.h>
|
||||||
|
#endif /* def HAVE_SYS_SOCKET_H */
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_SELECT_H
|
||||||
|
# include <sys/select.h>
|
||||||
|
#endif /* def HAVE_SYS_SELECT_H */
|
||||||
|
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# ifdef __VMS
|
# ifdef __VMS
|
||||||
|
26
src/ftp.c
26
src/ftp.c
@ -1152,13 +1152,25 @@ Error in server response, closing control connection.\n"));
|
|||||||
Elsewhere, define a constant "binary" flag.
|
Elsewhere, define a constant "binary" flag.
|
||||||
Isn't it nice to have distinct text and binary file types?
|
Isn't it nice to have distinct text and binary file types?
|
||||||
*/
|
*/
|
||||||
# define BIN_TYPE_TRANSFER (type_char != 'A')
|
/* 2011-09-30 SMS.
|
||||||
|
Added listing files to the set of non-"binary" (text, Stream_LF)
|
||||||
|
files. (Wget works either way, but other programs, like, say, text
|
||||||
|
editors, work better on listing files which have text attributes.)
|
||||||
|
Now we use "binary" attributes for a binary ("IMAGE") transfer,
|
||||||
|
unless "--ftp-stmlf" was specified, and we always use non-"binary"
|
||||||
|
(text, Stream_LF) attributes for a listing file, or for an ASCII
|
||||||
|
transfer.
|
||||||
|
Tidied the VMS-specific BIN_TYPE_xxx macros, and changed the call to
|
||||||
|
fopen_excl() (restored?) to use BIN_TYPE_FILE instead of "true".
|
||||||
|
*/
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
|
# define BIN_TYPE_TRANSFER (type_char != 'A')
|
||||||
|
# define BIN_TYPE_FILE \
|
||||||
|
((!(cmd & DO_LIST)) && BIN_TYPE_TRANSFER && (opt.ftp_stmlf == 0))
|
||||||
# define FOPEN_OPT_ARGS "fop=sqo", "acc", acc_cb, &open_id
|
# define FOPEN_OPT_ARGS "fop=sqo", "acc", acc_cb, &open_id
|
||||||
# define FOPEN_OPT_ARGS_BIN "ctx=bin,stm", "rfm=fix", "mrs=512" FOPEN_OPT_ARGS
|
# define FOPEN_OPT_ARGS_BIN "ctx=bin,stm", "rfm=fix", "mrs=512" FOPEN_OPT_ARGS
|
||||||
# define BIN_TYPE_FILE (BIN_TYPE_TRANSFER && (opt.ftp_stmlf == 0))
|
|
||||||
#else /* def __VMS */
|
#else /* def __VMS */
|
||||||
# define BIN_TYPE_FILE 1
|
# define BIN_TYPE_FILE true
|
||||||
#endif /* def __VMS [else] */
|
#endif /* def __VMS [else] */
|
||||||
|
|
||||||
if (restval && !(con->cmd & DO_LIST))
|
if (restval && !(con->cmd & DO_LIST))
|
||||||
@ -1217,7 +1229,7 @@ Error in server response, closing control connection.\n"));
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fp = fopen_excl (con->target, true);
|
fp = fopen_excl (con->target, BIN_TYPE_FILE);
|
||||||
if (!fp && errno == EEXIST)
|
if (!fp && errno == EEXIST)
|
||||||
{
|
{
|
||||||
/* We cannot just invent a new name and use it (which is
|
/* We cannot just invent a new name and use it (which is
|
||||||
@ -1880,8 +1892,10 @@ Already have correct symlink %s -> %s\n\n"),
|
|||||||
|
|
||||||
set_local_file (&actual_target, con->target);
|
set_local_file (&actual_target, con->target);
|
||||||
|
|
||||||
/* If downloading a plain file, set valid (non-zero) permissions. */
|
/* If downloading a plain file, and the user requested it, then
|
||||||
if (dlthis && (actual_target != NULL) && (f->type == FT_PLAINFILE))
|
set valid (non-zero) permissions. */
|
||||||
|
if (dlthis && (actual_target != NULL) &&
|
||||||
|
(f->type == FT_PLAINFILE) && opt.preserve_perm)
|
||||||
{
|
{
|
||||||
if (f->perms)
|
if (f->perms)
|
||||||
chmod (actual_target, f->perms);
|
chmod (actual_target, f->perms);
|
||||||
|
29
src/init.c
29
src/init.c
@ -214,7 +214,7 @@ static const struct {
|
|||||||
{ "postdata", &opt.post_data, cmd_string },
|
{ "postdata", &opt.post_data, cmd_string },
|
||||||
{ "postfile", &opt.post_file_name, cmd_file },
|
{ "postfile", &opt.post_file_name, cmd_file },
|
||||||
{ "preferfamily", NULL, cmd_spec_prefer_family },
|
{ "preferfamily", NULL, cmd_spec_prefer_family },
|
||||||
{ "preservepermissions", &opt.preserve_perm, cmd_boolean },/* deprecated */
|
{ "preservepermissions", &opt.preserve_perm, cmd_boolean },
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
{ "privatekey", &opt.private_key, cmd_file },
|
{ "privatekey", &opt.private_key, cmd_file },
|
||||||
{ "privatekeytype", &opt.private_key_type, cmd_cert_type },
|
{ "privatekeytype", &opt.private_key_type, cmd_cert_type },
|
||||||
@ -598,21 +598,34 @@ initialize (void)
|
|||||||
variable has been set. For internal testing purposes only! */
|
variable has been set. For internal testing purposes only! */
|
||||||
env_sysrc = getenv ("SYSTEM_WGETRC");
|
env_sysrc = getenv ("SYSTEM_WGETRC");
|
||||||
if (env_sysrc && file_exists_p (env_sysrc))
|
if (env_sysrc && file_exists_p (env_sysrc))
|
||||||
|
{
|
||||||
ok &= run_wgetrc (env_sysrc);
|
ok &= run_wgetrc (env_sysrc);
|
||||||
/* Otherwise, if SYSTEM_WGETRC is defined, use it. */
|
|
||||||
#ifdef SYSTEM_WGETRC
|
|
||||||
else if (file_exists_p (SYSTEM_WGETRC))
|
|
||||||
ok &= run_wgetrc (SYSTEM_WGETRC);
|
|
||||||
#endif
|
|
||||||
/* If there are any problems parsing the system wgetrc file, tell
|
/* If there are any problems parsing the system wgetrc file, tell
|
||||||
the user and exit */
|
the user and exit */
|
||||||
if (! ok)
|
if (! ok)
|
||||||
{
|
{
|
||||||
fprintf (stderr, _("\
|
fprintf (stderr, _("\
|
||||||
Parsing system wgetrc file failed, please check '%s'. \
|
Parsing system wgetrc file (env SYSTEM_WGETRC) failed. Please check\n\
|
||||||
Or specify a different file using --config\n"), SYSTEM_WGETRC);
|
'%s',\n\
|
||||||
|
or specify a different file using --config.\n"), env_sysrc);
|
||||||
exit (2);
|
exit (2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/* Otherwise, if SYSTEM_WGETRC is defined, use it. */
|
||||||
|
#ifdef SYSTEM_WGETRC
|
||||||
|
else if (file_exists_p (SYSTEM_WGETRC))
|
||||||
|
ok &= run_wgetrc (SYSTEM_WGETRC);
|
||||||
|
/* If there are any problems parsing the system wgetrc file, tell
|
||||||
|
the user and exit */
|
||||||
|
if (! ok)
|
||||||
|
{
|
||||||
|
fprintf (stderr, _("\
|
||||||
|
Parsing system wgetrc file failed. Please check\n\
|
||||||
|
'%s',\n\
|
||||||
|
or specify a different file using --config.\n"), SYSTEM_WGETRC);
|
||||||
|
exit (2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Override it with your own, if one exists. */
|
/* Override it with your own, if one exists. */
|
||||||
file = wgetrc_file_name ();
|
file = wgetrc_file_name ();
|
||||||
if (!file)
|
if (!file)
|
||||||
|
@ -573,14 +573,14 @@ log_init (const char *file, bool appendp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close LOGFP, inhibit further logging and free the memory associated
|
/* Close LOGFP (only if we opened it, not if it's stderr), inhibit
|
||||||
with it. */
|
further logging and free the memory associated with it. */
|
||||||
void
|
void
|
||||||
log_close (void)
|
log_close (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (logfp)
|
if (logfp && (logfp != stderr))
|
||||||
fclose (logfp);
|
fclose (logfp);
|
||||||
logfp = NULL;
|
logfp = NULL;
|
||||||
inhibit_logging = true;
|
inhibit_logging = true;
|
||||||
|
15
src/main.c
15
src/main.c
@ -243,7 +243,7 @@ static struct cmdline_option option_data[] =
|
|||||||
{ "post-data", 0, OPT_VALUE, "postdata", -1 },
|
{ "post-data", 0, OPT_VALUE, "postdata", -1 },
|
||||||
{ "post-file", 0, OPT_VALUE, "postfile", -1 },
|
{ "post-file", 0, OPT_VALUE, "postfile", -1 },
|
||||||
{ "prefer-family", 0, OPT_VALUE, "preferfamily", -1 },
|
{ "prefer-family", 0, OPT_VALUE, "preferfamily", -1 },
|
||||||
{ "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 }, /* deprecated */
|
{ "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 },
|
||||||
{ IF_SSL ("private-key"), 0, OPT_VALUE, "privatekey", -1 },
|
{ IF_SSL ("private-key"), 0, OPT_VALUE, "privatekey", -1 },
|
||||||
{ IF_SSL ("private-key-type"), 0, OPT_VALUE, "privatekeytype", -1 },
|
{ IF_SSL ("private-key-type"), 0, OPT_VALUE, "privatekeytype", -1 },
|
||||||
{ "progress", 0, OPT_VALUE, "progress", -1 },
|
{ "progress", 0, OPT_VALUE, "progress", -1 },
|
||||||
@ -646,6 +646,8 @@ FTP options:\n"),
|
|||||||
--no-glob turn off FTP file name globbing.\n"),
|
--no-glob turn off FTP file name globbing.\n"),
|
||||||
N_("\
|
N_("\
|
||||||
--no-passive-ftp disable the \"passive\" transfer mode.\n"),
|
--no-passive-ftp disable the \"passive\" transfer mode.\n"),
|
||||||
|
N_("\
|
||||||
|
--preserve-permissions preserve remote file permissions.\n"),
|
||||||
N_("\
|
N_("\
|
||||||
--retr-symlinks when recursing, get linked-to files (not dir).\n"),
|
--retr-symlinks when recursing, get linked-to files (not dir).\n"),
|
||||||
"\n",
|
"\n",
|
||||||
@ -948,8 +950,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
init_switches ();
|
init_switches ();
|
||||||
|
|
||||||
/* This seperate getopt_long is needed to find the user config
|
/* This separate getopt_long is needed to find the user config file
|
||||||
and parse it before the other user options. */
|
option ("--config") and parse it before the other user options. */
|
||||||
longindex = -1;
|
longindex = -1;
|
||||||
int retconf;
|
int retconf;
|
||||||
bool use_userconfig = false;
|
bool use_userconfig = false;
|
||||||
@ -960,6 +962,10 @@ main (int argc, char **argv)
|
|||||||
int confval;
|
int confval;
|
||||||
bool userrc_ret = true;
|
bool userrc_ret = true;
|
||||||
struct cmdline_option *config_opt;
|
struct cmdline_option *config_opt;
|
||||||
|
|
||||||
|
/* There is no short option for "--config". */
|
||||||
|
if (longindex >= 0)
|
||||||
|
{
|
||||||
confval = long_options[longindex].val;
|
confval = long_options[longindex].val;
|
||||||
config_opt = &option_data[confval & ~BOOLEAN_NEG_MARKER];
|
config_opt = &option_data[confval & ~BOOLEAN_NEG_MARKER];
|
||||||
if (strcmp (config_opt->long_name, "config") == 0)
|
if (strcmp (config_opt->long_name, "config") == 0)
|
||||||
@ -975,6 +981,7 @@ main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If the user did not specify a config, read the system wgetrc and ~/.wgetrc. */
|
/* If the user did not specify a config, read the system wgetrc and ~/.wgetrc. */
|
||||||
if (use_userconfig == false)
|
if (use_userconfig == false)
|
||||||
@ -1470,7 +1477,7 @@ outputting to a regular file.\n"));
|
|||||||
xfree (url[i]);
|
xfree (url[i]);
|
||||||
cleanup ();
|
cleanup ();
|
||||||
|
|
||||||
return get_exit_status ();
|
exit (get_exit_status ());
|
||||||
}
|
}
|
||||||
#endif /* TESTING */
|
#endif /* TESTING */
|
||||||
|
|
||||||
|
@ -201,7 +201,9 @@ ssl_init ()
|
|||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ssl_ctx = SSL_CTX_new (meth);
|
/* The type cast below accommodates older OpenSSL versions (0.9.8)
|
||||||
|
where SSL_CTX_new() is declared without a "const" argument. */
|
||||||
|
ssl_ctx = SSL_CTX_new ((SSL_METHOD *)meth);
|
||||||
if (!ssl_ctx)
|
if (!ssl_ctx)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -769,8 +769,7 @@ fopen_excl (const char *fname, int binary)
|
|||||||
open_id = 13;
|
open_id = 13;
|
||||||
fd = open( fname, /* File name. */
|
fd = open( fname, /* File name. */
|
||||||
flags, /* Flags. */
|
flags, /* Flags. */
|
||||||
0777, /* Mode for default protection.
|
0777, /* Mode for default protection. */
|
||||||
*/
|
|
||||||
"rfm=stmlf", /* Stream_LF. */
|
"rfm=stmlf", /* Stream_LF. */
|
||||||
OPEN_OPT_ARGS); /* Access callback. */
|
OPEN_OPT_ARGS); /* Access callback. */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user