Commit b86f0cef authored by David Dykstra's avatar David Dykstra

Add --quiet/-q option. Contributed by Rich Salz salzr@certco.com.

parent c226b7c2
...@@ -292,7 +292,7 @@ static int rsync_module(int fd, int i) ...@@ -292,7 +292,7 @@ static int rsync_module(int fd, int i)
} }
} }
ret = parse_arguments(argc, argv); ret = parse_arguments(argc, argv, 0);
if (request) { if (request) {
if (*auth_user) { if (*auth_user) {
......
...@@ -87,8 +87,11 @@ void log_open(void) ...@@ -87,8 +87,11 @@ void log_open(void)
int len; int len;
FILE *f=NULL; FILE *f=NULL;
extern int am_daemon; extern int am_daemon;
extern int quiet;
/* recursion can happen with certain fatal conditions */ /* recursion can happen with certain fatal conditions */
if (quiet != 0 && fd == FINFO) return;
va_start(ap, format); va_start(ap, format);
len = vslprintf(buf, sizeof(buf), format, ap); len = vslprintf(buf, sizeof(buf), format, ap);
va_end(ap); va_end(ap);
......
...@@ -592,7 +592,7 @@ int main(int argc,char *argv[]) ...@@ -592,7 +592,7 @@ int main(int argc,char *argv[])
carried across */ carried across */
orig_umask = (int)umask(0); orig_umask = (int)umask(0);
if (!parse_arguments(argc, argv)) { if (!parse_arguments(argc, argv, 1)) {
exit_cleanup(RERR_SYNTAX); exit_cleanup(RERR_SYNTAX);
} }
......
...@@ -72,6 +72,7 @@ char *rsync_path = RSYNC_NAME; ...@@ -72,6 +72,7 @@ char *rsync_path = RSYNC_NAME;
int rsync_port = RSYNC_PORT; int rsync_port = RSYNC_PORT;
int verbose = 0; int verbose = 0;
int quiet = 0;
int always_checksum = 0; int always_checksum = 0;
int list_only = 0; int list_only = 0;
...@@ -90,6 +91,7 @@ void usage(int F) ...@@ -90,6 +91,7 @@ void usage(int F)
rprintf(F," or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]\n"); rprintf(F," or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]\n");
rprintf(F,"\nOptions\n"); rprintf(F,"\nOptions\n");
rprintf(F," -v, --verbose increase verbosity\n"); rprintf(F," -v, --verbose increase verbosity\n");
rprintf(F," -q, --quiet decrease verbosity\n");
rprintf(F," -c, --checksum always checksum\n"); rprintf(F," -c, --checksum always checksum\n");
rprintf(F," -a, --archive archive mode\n"); rprintf(F," -a, --archive archive mode\n");
rprintf(F," -r, --recursive recurse into directories\n"); rprintf(F," -r, --recursive recurse into directories\n");
...@@ -151,7 +153,7 @@ enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE, ...@@ -151,7 +153,7 @@ enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_STATS, OPT_PARTIAL, OPT_PROGRESS, OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_STATS, OPT_PARTIAL, OPT_PROGRESS,
OPT_SAFE_LINKS, OPT_COMPARE_DEST, OPT_LOG_FORMAT,OPT_PASSWORD_FILE}; OPT_SAFE_LINKS, OPT_COMPARE_DEST, OPT_LOG_FORMAT,OPT_PASSWORD_FILE};
static char *short_options = "oblLWHpguDCtcahvrRIxnSe:B:T:z"; static char *short_options = "oblLWHpguDCtcahvqrRIxnSe:B:T:z";
static struct option long_options[] = { static struct option long_options[] = {
{"version", 0, 0, OPT_VERSION}, {"version", 0, 0, OPT_VERSION},
...@@ -177,6 +179,7 @@ static struct option long_options[] = { ...@@ -177,6 +179,7 @@ static struct option long_options[] = {
{"backup", 0, 0, 'b'}, {"backup", 0, 0, 'b'},
{"update", 0, 0, 'u'}, {"update", 0, 0, 'u'},
{"verbose", 0, 0, 'v'}, {"verbose", 0, 0, 'v'},
{"quiet", 0, 0, 'q'},
{"recursive", 0, 0, 'r'}, {"recursive", 0, 0, 'r'},
{"relative", 0, 0, 'R'}, {"relative", 0, 0, 'R'},
{"devices", 0, 0, 'D'}, {"devices", 0, 0, 'D'},
...@@ -249,7 +252,7 @@ static int check_refuse_options(char *ref, int opt) ...@@ -249,7 +252,7 @@ static int check_refuse_options(char *ref, int opt)
} }
int parse_arguments(int argc, char *argv[]) int parse_arguments(int argc, char *argv[], int frommain)
{ {
int opt; int opt;
int option_index; int option_index;
...@@ -395,6 +398,10 @@ int parse_arguments(int argc, char *argv[]) ...@@ -395,6 +398,10 @@ int parse_arguments(int argc, char *argv[])
verbose++; verbose++;
break; break;
case 'q':
if (frommain) quiet++;
break;
case 'a': case 'a':
recurse=1; recurse=1;
#if SUPPORT_LINKS #if SUPPORT_LINKS
...@@ -507,6 +514,7 @@ void server_options(char **args,int *argc) ...@@ -507,6 +514,7 @@ void server_options(char **args,int *argc)
argstr[0] = '-'; argstr[0] = '-';
for (i=0;i<verbose;i++) for (i=0;i<verbose;i++)
argstr[x++] = 'v'; argstr[x++] = 'v';
/* the -q option is intentionally left out */
if (make_backups) if (make_backups)
argstr[x++] = 'b'; argstr[x++] = 'b';
if (update_only) if (update_only)
......
mailto(rsync-bugs@samba.org) mailto(rsync-bugs@samba.org)
manpage(rsync)(1)(7 Jan 1999)()() manpage(rsync)(1)(9 Feb 1999)()()
manpagename(rsync)(faster, flexible replacement for rcp) manpagename(rsync)(faster, flexible replacement for rcp)
manpagesynopsis() manpagesynopsis()
...@@ -220,6 +220,7 @@ Usage: rsync [OPTION]... SRC [USER@]HOST:DEST ...@@ -220,6 +220,7 @@ Usage: rsync [OPTION]... SRC [USER@]HOST:DEST
Options Options
-v, --verbose increase verbosity -v, --verbose increase verbosity
-q, --quiet decrease verbosity
-c, --checksum always checksum -c, --checksum always checksum
-a, --archive archive mode -a, --archive archive mode
-r, --recursive recurse into directories -r, --recursive recurse into directories
...@@ -288,6 +289,11 @@ information on what files are being skipped and slightly more ...@@ -288,6 +289,11 @@ information on what files are being skipped and slightly more
information at the end. More than two -v flags should only be used if information at the end. More than two -v flags should only be used if
you are debugging rsync. you are debugging rsync.
dit(bf(-q, --quiet)) This option decreases the amount of information you
are given during the transfer, notably suppressing information messages
from the remote server. This flag is useful when invoking rsync from
cron.
dit(bf(-I, --ignore-times)) Normally rsync will skip any files that are dit(bf(-I, --ignore-times)) Normally rsync will skip any files that are
already the same length and have the same time-stamp. This option turns already the same length and have the same time-stamp. This option turns
off this behavior. off this behavior.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment