Using vargs in cons_bad_show

This commit is contained in:
James Booth
2012-11-10 01:39:42 +00:00
parent 81f9292948
commit a5082a54bd
4 changed files with 21 additions and 16 deletions

View File

@@ -135,18 +135,12 @@ prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp)
void
prof_handle_error_message(const char *from, const char *err_msg)
{
char *msg, *fmt;
if (err_msg != NULL) {
fmt = "Error received from server: %s";
msg = (char *)malloc(strlen(err_msg) + strlen(fmt) - 1);
if (msg == NULL)
goto loop_out;
sprintf(msg, fmt, err_msg);
cons_bad_show(msg);
free(msg);
cons_bad_show("Error received from server: %s", err_msg);
} else {
cons_bad_show("Unknown error received from server.");
}
loop_out:
win_show_error_msg(from, err_msg);
}