void hash_result_as_bytes(struct mdfour *md, unsigned char *out);
void hash_buffer(struct mdfour *md, const void *s, size_t len);
+void cc_log_no_newline(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
void cc_log(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
void fatal(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
static FILE *logfile;
-/* log a message to the CCACHE_LOGFILE location */
-void cc_log(const char *format, ...)
+static void cc_log_va_list(const char *format, va_list ap)
{
- va_list ap;
extern char *cache_logfile;
if (!cache_logfile) return;
if (!logfile) return;
fprintf(logfile, "[%-5d] ", getpid());
- va_start(ap, format);
vfprintf(logfile, format, ap);
+}
+
+/*
+ * Log a message to the CCACHE_LOGFILE location without newline and without
+ * flushing.
+ */
+void cc_log_no_newline(const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ cc_log_va_list(format, ap);
+ va_end(ap);
+}
+
+/*
+ * Log a message to the CCACHE_LOGFILE location adding a newline and flushing.
+ */
+void cc_log(const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ cc_log_va_list(format, ap);
va_end(ap);
fprintf(logfile, "\n");
fflush(logfile);