* 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 == '-')
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)