diff options
author | Wayne Davison <wayned@samba.org> | 2008-07-19 22:45:05 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2008-07-19 22:50:28 -0700 |
commit | 886df221c1ce1660a2b6cd274b13952b482fe5bf (patch) | |
tree | debfb3dd61dc6e2ac952d5f641f9c891435250fa /log.c | |
parent | fb01d1fb07f6efd3752ff895fe8a77e26a2b2055 (diff) | |
download | rsync-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.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 "; |