mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
use the dynamic buffer for both curses and stdout
This commit is contained in:
parent
9ffe53178c
commit
3909176957
1 changed files with 18 additions and 20 deletions
|
@ -174,13 +174,10 @@ C_Shutdown (void)
|
||||||
static void
|
static void
|
||||||
C_Print (const char *fmt, va_list args)
|
C_Print (const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CURSES_H
|
static unsigned char *buffer;
|
||||||
if (use_curses) {
|
unsigned char *txt;
|
||||||
char *txt;
|
|
||||||
static char *buffer;
|
|
||||||
int size;
|
int size;
|
||||||
static int buffer_size;
|
static int buffer_size;
|
||||||
chtype ch;
|
|
||||||
|
|
||||||
size = vsnprintf (buffer, buffer_size, fmt, args);
|
size = vsnprintf (buffer, buffer_size, fmt, args);
|
||||||
if (size + 1 > buffer_size) {
|
if (size + 1 > buffer_size) {
|
||||||
|
@ -193,6 +190,11 @@ C_Print (const char *fmt, va_list args)
|
||||||
}
|
}
|
||||||
|
|
||||||
txt = buffer;
|
txt = buffer;
|
||||||
|
#ifdef HAVE_CURSES_H
|
||||||
|
if (use_curses) {
|
||||||
|
chtype ch;
|
||||||
|
|
||||||
|
txt = buffer;
|
||||||
|
|
||||||
while ((ch = (byte)*txt++)) {
|
while ((ch = (byte)*txt++)) {
|
||||||
ch = sys_char_map[ch] | attr_table[attr_map[ch]];
|
ch = sys_char_map[ch] | attr_table[attr_map[ch]];
|
||||||
|
@ -203,12 +205,8 @@ C_Print (const char *fmt, va_list args)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
char msg[4096];
|
while (*txt)
|
||||||
unsigned char *p;
|
putc (sys_char_map[*txt++], stdout);
|
||||||
|
|
||||||
vsnprintf (msg, sizeof (msg), fmt, args);
|
|
||||||
for (p = (unsigned char *) msg; *p; p++)
|
|
||||||
putc (sys_char_map[*p], stdout);
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue