client messages

svn path=/trunk/boinc/; revision=1378
This commit is contained in:
David Anderson 2003-06-11 22:42:51 +00:00
parent 5f9c10aca6
commit 4b426b3c16
2 changed files with 25 additions and 0 deletions

View File

@ -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 \

24
client/message.C Normal file
View File

@ -0,0 +1,24 @@
#include <stdarg.h>
#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);
}