mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-02 02:40:58 +00:00
Added "last message repeated xx times" to cut down repeated lines from Sys_Printf.
This commit is contained in:
parent
da1b50442f
commit
7e689832db
1 changed files with 17 additions and 6 deletions
|
@ -88,7 +88,7 @@ static char qfont_table[256] =
|
||||||
'x', 'y', 'z', '{', '|', '}', '~', '<'
|
'x', 'y', 'z', '{', '|', '}', '~', '<'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MAXPRINTMSG 4096
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
Sys_Printf
|
Sys_Printf
|
||||||
|
@ -97,17 +97,28 @@ Sys_Printf
|
||||||
void Sys_Printf (char *fmt, ...)
|
void Sys_Printf (char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char text[2048];
|
char msg[MAXPRINTMSG];
|
||||||
unsigned char *p;
|
static char lastmessage[MAXPRINTMSG];
|
||||||
|
static int msgcount=0;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
if (sys_nostdout->value) return;
|
if (sys_nostdout->value) return;
|
||||||
|
|
||||||
va_start(argptr,fmt);
|
va_start(argptr,fmt);
|
||||||
vsnprintf(text, sizeof(text), fmt, argptr);
|
vsnprintf(msg, sizeof(msg), fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
|
if (strncmp(lastmessage,msg,MAXPRINTMSG)==0) {
|
||||||
|
msgcount+=1;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (msgcount>0) printf("Last message repeated %d times\n",msgcount);
|
||||||
|
strncpy(lastmessage,msg,MAXPRINTMSG);
|
||||||
|
msgcount=0;
|
||||||
|
}
|
||||||
|
|
||||||
/* translate to ASCII instead of printing [xx] --KB */
|
/* translate to ASCII instead of printing [xx] --KB */
|
||||||
for (p = (unsigned char *)text; *p; p++)
|
for (p = (unsigned char *)msg; *p; p++)
|
||||||
putc(qfont_table[*p], stdout);
|
putc(qfont_table[*p], stdout);
|
||||||
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
|
Loading…
Reference in a new issue