summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-07-19 22:45:05 -0700
committerWayne Davison <wayned@samba.org>2008-07-19 22:50:28 -0700
commit886df221c1ce1660a2b6cd274b13952b482fe5bf (patch)
treedebfb3dd61dc6e2ac952d5f641f9c891435250fa /log.c
parentfb01d1fb07f6efd3752ff895fe8a77e26a2b2055 (diff)
downloadrsync-886df221c1ce1660a2b6cd274b13952b482fe5bf.tar.gz
rsync-886df221c1ce1660a2b6cd274b13952b482fe5bf.tar.bz2
rsync-886df221c1ce1660a2b6cd274b13952b482fe5bf.zip
Added a '%C' (MD5 checksum) flag for the output/logfile formatting.
Diffstat (limited to 'log.c')
-rw-r--r--log.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/log.c b/log.c
index 4db96637..8f8f049f 100644
--- a/log.c
+++ b/log.c
@@ -31,8 +31,10 @@ extern int local_server;
extern int quiet;
extern int module_id;
extern int msg_fd_out;
+extern int checksum_len;
extern int allow_8bit_chars;
extern int protocol_version;
+extern int always_checksum;
extern int preserve_times;
extern int uid_ndx;
extern int gid_ndx;
@@ -55,6 +57,7 @@ extern iconv_t ic_send, ic_recv;
extern char curr_dir[];
extern char *module_dir;
extern unsigned int module_dirlen;
+extern char sender_file_sum[];
static int log_initialised;
static int logfile_was_closed;
@@ -633,6 +636,28 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
snprintf(buf2, sizeof buf2, fmt, big_num(b, 0));
n = buf2;
break;
+ case 'C':
+ if (protocol_version >= 30
+ && (iflags & ITEM_TRANSFER
+ || (always_checksum && S_ISREG(file->mode)))) {
+ int i, x1, x2;
+ const char *sum = iflags & ITEM_TRANSFER
+ ? sender_file_sum : F_SUM(file);
+ c = buf2 + checksum_len*2;
+ *c = '\0';
+ for (i = checksum_len; --i >= 0; ) {
+ x1 = CVAL(sum, i);
+ x2 = x1 >> 4;
+ x1 &= 0xF;
+ *--c = x1 <= 9 ? x1 + '0' : x1 + 'a' - 10;
+ *--c = x2 <= 9 ? x2 + '0' : x2 + 'a' - 10;
+ }
+ } else {
+ memset(buf2, ' ', checksum_len*2);
+ buf2[checksum_len*2] = '\0';
+ }
+ n = buf2;
+ break;
case 'i':
if (iflags & ITEM_DELETED) {
n = "*deleting ";