Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e145d51
)
Added log_format_has().
author
Wayne Davison
<wayned@samba.org>
Thu, 31 Mar 2005 00:19:13 +0000
(
00:19
+0000)
committer
Wayne Davison
<wayned@samba.org>
Thu, 31 Mar 2005 00:19:13 +0000
(
00:19
+0000)
log.c
patch
|
blob
|
blame
|
history
diff --git
a/log.c
b/log.c
index
87cd1d7
..
c8a433d
100644
(file)
--- 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);
* 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 == '-')
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);
}
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)
/* log the transfer of a file */
void log_item(struct file_struct *file, struct stats *initial_stats,
int iflags, char *hlink)