summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2005-03-31 00:19:13 +0000
committerWayne Davison <wayned@samba.org>2005-03-31 00:19:13 +0000
commit16f960feb501d9c2444c1b5d8ad5ba81e932b975 (patch)
tree7fb6c7bbc5057d2ebaafb860ffa4000880a9a6b9 /log.c
parente145d51ba6d4a90ab86f7f22b1c75be4e62ba916 (diff)
downloadrsync-16f960feb501d9c2444c1b5d8ad5ba81e932b975.tar.gz
rsync-16f960feb501d9c2444c1b5d8ad5ba81e932b975.tar.bz2
rsync-16f960feb501d9c2444c1b5d8ad5ba81e932b975.zip
Added log_format_has().
Diffstat (limited to 'log.c')
-rw-r--r--log.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/log.c b/log.c
index 87cd1d77..c8a433db 100644
--- a/log.c
+++ b/log.c
@@ -364,7 +364,7 @@ static void log_formatted(enum logcode code, char *format, char *op,
* rather keep going until we reach the nul of the format. */
total = strlcpy(buf, format, sizeof buf);
- for (p = buf; (p = strchr(p, '%')) != NULL && p[1]; ) {
+ for (p = buf; (p = strchr(p, '%')) != NULL; ) {
s = p++;
n = fmt + 1;
if (*p == '-')
@@ -535,6 +535,26 @@ static void log_formatted(enum logcode code, char *format, char *op,
rprintf(code, "%s\n", buf);
}
+int log_format_has(const char *format, char esc)
+{
+ const char *p;
+
+ if (!format)
+ return 0;
+
+ for (p = format; (p = strchr(p, '%')) != NULL; ) {
+ if (*++p == '-')
+ p++;
+ while (isdigit(*(uchar*)p))
+ p++;
+ if (!*p)
+ break;
+ if (*p == esc)
+ return 1;
+ }
+ return 0;
+}
+
/* log the transfer of a file */
void log_item(struct file_struct *file, struct stats *initial_stats,
int iflags, char *hlink)