Use new log_format_has() function instead of strstr().
authorWayne Davison <wayned@samba.org>
Thu, 31 Mar 2005 00:21:15 +0000 (00:21 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 31 Mar 2005 00:21:15 +0000 (00:21 +0000)
clientserver.c
options.c

index 531944a..47ed5e7 100644 (file)
@@ -283,10 +283,10 @@ static int rsync_module(int f_in, int f_out, int i)
                read_only = 1;
 
        if (lp_transfer_logging(i)) {
-               if (strstr(lp_log_format(i), "%i") != NULL)
+               if (log_format_has(lp_log_format(i), 'i'))
                        daemon_log_format_has_i = 1;
                if (daemon_log_format_has_i
-                   || strstr(lp_log_format(i), "%o") != NULL)
+                   || log_format_has(lp_log_format(i), 'o'))
                        daemon_log_format_has_o_or_i = 1;
        }
 
index 14b6634..e6bc32b 100644 (file)
--- a/options.c
+++ b/options.c
@@ -150,7 +150,6 @@ char *dest_option = NULL;
 
 int verbose = 0;
 int quiet = 0;
-int itemize_changes = 0;
 int log_before_transfer = 0;
 int log_format_has_i = 0;
 int log_format_has_o_or_i = 0;
@@ -163,6 +162,7 @@ char *batch_name = NULL;
 static int daemon_opt;   /* sets am_daemon after option error-reporting */
 static int F_option_cnt = 0;
 static int modify_window_set;
+static int itemize_changes = 0;
 static int refused_delete, refused_archive_part;
 static int refused_partial, refused_progress, refused_delete_before;
 static char *max_size_arg;
@@ -1078,10 +1078,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                omit_dir_times = 1;
 
        if (log_format) {
-               if (strstr(log_format, "%i") != NULL)
+               if (log_format_has(log_format, 'i'))
                        log_format_has_i = 1;
-               if (strstr(log_format, "%b") == NULL
-                && strstr(log_format, "%c") == NULL)
+               if (!log_format_has(log_format, 'b')
+                && !log_format_has(log_format, 'c'))
                        log_before_transfer = !am_server;
        } else if (itemize_changes) {
                log_format = "%i %n%L";
@@ -1097,8 +1097,7 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                log_format = "%n%L";
                log_before_transfer = !am_server;
        }
-       if (log_format_has_i
-           || (log_format && strstr(log_format, "%o") != NULL))
+       if (log_format_has_i || log_format_has(log_format, 'o'))
                log_format_has_o_or_i = 1;
 
        if (daemon_bwlimit && (!bwlimit || bwlimit > daemon_bwlimit))