From ad75dd2662b11cb806ed92ba194dd04f85c68ba2 Mon Sep 17 00:00:00 2001 From: hniksic Date: Thu, 6 Nov 2003 12:33:20 -0800 Subject: [PATCH] [svn] Applied Dennis Smit's --preserve-permissions patch. --- src/ChangeLog | 11 +++++++++++ src/ftp.c | 5 ++++- src/init.c | 1 + src/main.c | 18 ++++++++++-------- src/options.h | 3 +++ 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9942941e..5c07af86 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2003-11-05 Dennis Smit + + * main.c: (main): added --preserve-permissions option. + + * ftp.c (ftp_retrieve_list): added support for + --preserve-permissions option. + + * init.c: added support for --preserve-permission option. + + * option.h: added support for --preserve-permission option. + 2003-11-06 Hrvoje Niksic * main.c (init_switches): New function. Convert option_data to diff --git a/src/ftp.c b/src/ftp.c index 87bd8668..7e878e42 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1630,7 +1630,10 @@ Already have correct symlink %s -> %s\n\n"), logprintf (LOG_NOTQUIET, _("%s: corrupt time-stamp.\n"), con->target); if (f->perms && f->type == FT_PLAINFILE && dlthis) - chmod (con->target, f->perms); + { + if (opt.preserve_perm) + chmod (con->target, f->perms); + } else DEBUGP (("Unrecognized permissions for %s.\n", con->target)); diff --git a/src/init.c b/src/init.c index c0f260ed..abafecdd 100644 --- a/src/init.c +++ b/src/init.c @@ -185,6 +185,7 @@ static struct { { "passwd", &opt.ftp_pass, cmd_string }, { "postdata", &opt.post_data, cmd_string }, { "postfile", &opt.post_file_name, cmd_file }, + { "preservepermissions", &opt.preserve_perm, cmd_boolean }, { "progress", &opt.progress_type, cmd_spec_progress }, { "proxypasswd", &opt.proxy_passwd, cmd_string }, { "proxyuser", &opt.proxy_user, cmd_string }, diff --git a/src/main.c b/src/main.c index 922d605b..eaeaa770 100644 --- a/src/main.c +++ b/src/main.c @@ -212,6 +212,7 @@ struct cmdline_option option_data[] = { "passive-ftp", 0, OPT_BOOLEAN, "passiveftp", -1 }, { "post-data", 0, OPT_VALUE, "postdata", -1 }, { "post-file", 0, OPT_VALUE, "postfile", -1 }, + { "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 }, { "progress", 0, OPT_VALUE, "progress", -1 }, { "proxy", 'Y', OPT_BOOLEAN, "useproxy", -1 }, { "proxy-passwd", 0, OPT_VALUE, "proxypasswd", -1 }, @@ -462,14 +463,15 @@ FTP options:\n\ \n"), stdout); fputs (_("\ Recursive retrieval:\n\ - -r, --recursive recursive download.\n\ - -l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n\ - --delete-after delete files locally after downloading them.\n\ - -k, --convert-links convert non-relative links to relative.\n\ - -K, --backup-converted before converting file X, back up as X.orig.\n\ - -m, --mirror shortcut option equivalent to -r -N -l inf -nr.\n\ - -p, --page-requisites get all images, etc. needed to display HTML page.\n\ - --strict-comments turn on strict (SGML) handling of HTML comments.\n\ + -r, --recursive recursive download.\n\ + -l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).\n\ + --delete-after delete files locally after downloading them.\n\ + -k, --convert-links convert non-relative links to relative.\n\ + -K, --backup-converted before converting file X, back up as X.orig.\n\ + -m, --mirror shortcut option equivalent to -r -N -l inf -nr.\n\ + -p, --page-requisites get all images, etc. needed to display HTML page.\n\ + --strict-comments turn on strict (SGML) handling of HTML comments.\n\ + --preserve-permissions preserve remote file permissions.\n\ \n"), stdout); fputs (_("\ Recursive accept/reject:\n\ diff --git a/src/options.h b/src/options.h index 6adeb6bd..e107fb09 100644 --- a/src/options.h +++ b/src/options.h @@ -196,6 +196,9 @@ struct options int strict_comments; /* whether strict SGML comments are enforced. */ + + int preserve_perm; /* whether remote permissions are used + or that what is set by umask. */ }; extern struct options opt;