diff --git a/client/Makefile.in b/client/Makefile.in index a0adb8f0c9..e1eadf076d 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -191,6 +191,7 @@ boinc_client_SOURCES = \ hostinfo_unix.C \ http.C \ log_flags.C \ + message.C \ net_stats.C \ net_xfer.C \ pers_file_xfer.C \ diff --git a/client/message.C b/client/message.C new file mode 100644 index 0000000000..e378495715 --- /dev/null +++ b/client/message.C @@ -0,0 +1,24 @@ +#include + +#include "message.h" + +// Takes a printf style formatted string, inserts the proper values, +// and passes it to show_message +// TODO: add translation functionality +// +void msg_printf(PROJECT *p, int priority, char *fmt, ...) { + char buf[512]; + va_list ap; + + if (fmt == NULL) return; + + // Since Windows doesn't support vsnprintf, we have to do a + // workaround to prevent buffer overruns + // + if (strlen(fmt) > 512) fmt[511] = '\0'; + va_start(ap, fmt); // Parses string for variables + vsprintf(buf, fmt, ap); // And convert symbols To actual numbers + va_end(ap); // Results are stored in text + + show_message(p, buf, priority); +}