optionally disable the curses server console, bringing back the old behaviour

This commit is contained in:
Bill Currie 2001-07-19 05:13:32 +00:00
parent a771b5bd6c
commit 5e81d80d8c
2 changed files with 44 additions and 11 deletions

View file

@ -92,7 +92,7 @@ AC_HEADER_STDC
AC_HEADER_MAJOR AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS( AC_CHECK_HEADERS(
arpa/inet.h asm/io.h assert.h conio.h ctype.h curses.h ddraw.h dinput.h \ arpa/inet.h asm/io.h assert.h conio.h ctype.h ddraw.h dinput.h \
direct.h dirent.h dlfcn.h dmedia/audio.h dmedia/cdaudio.h dpmi.h \ direct.h dirent.h dlfcn.h dmedia/audio.h dmedia/cdaudio.h dpmi.h \
dsound.h errno.h fcntl.h fnmatch.h glide/sst1vid.h io.h \ dsound.h errno.h fcntl.h fnmatch.h glide/sst1vid.h io.h \
libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \ libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \
@ -270,16 +270,25 @@ if test "x$ac_cv_func_dlopen" != "xyes"; then
fi fi
AC_SUBST(DL_LIBS) AC_SUBST(DL_LIBS)
AC_CHECK_LIB(ncurses, initscr, AC_ARG_ENABLE(curses,
CURSES_LIBS=-lncurses, [ --disable-curses disable curses support]
AC_CHECK_LIB(pdcurses, initscr, )
CURSES_LIBS=-lpdcurses,
AC_CHECK_LIB(curses, initscr, if test "x$enable_curses" != "xno"; then
CURSES_LIBS=-lcurses, AC_CHECK_HEADERS(curses.h)
CURSES_LIBS= AC_CHECK_LIB(ncurses, initscr,
CURSES_LIBS=-lncurses,
AC_CHECK_LIB(pdcurses, initscr,
CURSES_LIBS=-lpdcurses,
AC_CHECK_LIB(curses, initscr,
CURSES_LIBS=-lcurses,
CURSES_LIBS=
)
) )
) )
) else
CURSES_LIBS=
fi
AC_SUBST(CURSES_LIBS) AC_SUBST(CURSES_LIBS)
dnl Checks for stricmp/strcasecmp dnl Checks for stricmp/strcasecmp

View file

@ -54,6 +54,7 @@
#include "server.h" #include "server.h"
#ifdef HAVE_CURSES_H
static WINDOW *output; static WINDOW *output;
static WINDOW *status; static WINDOW *status;
static WINDOW *input; static WINDOW *input;
@ -90,10 +91,12 @@ static const byte attr_map[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };
#endif
void void
Con_Init (const char *plugin_name) Con_Init (const char *plugin_name)
{ {
#ifdef HAVE_CURSES_H
int i; int i;
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
@ -138,20 +141,24 @@ Con_Init (const char *plugin_name)
wrefresh (output); wrefresh (output);
wrefresh (status); wrefresh (status);
wrefresh (input); wrefresh (input);
#endif
} }
void void
Con_Shutdown (void) Con_Shutdown (void)
{ {
#ifdef HAVE_CURSES_H
endwin (); endwin ();
#endif
} }
void void
Con_Print (const char *txt) Con_Print (const char *txt)
{ {
chtype ch; #ifdef HAVE_CURSES_H
if (output) { if (output) {
chtype ch;
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]];
waddch (output, ch); waddch (output, ch);
@ -159,16 +166,21 @@ Con_Print (const char *txt)
touchwin (stdscr); touchwin (stdscr);
wrefresh (output); wrefresh (output);
} else { } else {
#endif
int ch;
while ((ch = (byte)*txt++)) { while ((ch = (byte)*txt++)) {
ch = sys_char_map[ch]; ch = sys_char_map[ch];
putchar (ch); putchar (ch);
} }
#ifdef HAVE_CURSES_H
} }
#endif
} }
void void
Con_ProcessInput (inputline_t *il, int ch) Con_ProcessInput (inputline_t *il, int ch)
{ {
#ifdef HAVE_CURSES_H
int i; int i;
int curs_x; int curs_x;
char *text = 0; char *text = 0;
@ -302,8 +314,19 @@ Con_ProcessInput (inputline_t *il, int ch)
wmove (input, 0, curs_x); wmove (input, 0, curs_x);
touchline (stdscr, screen_y - 1, 1); touchline (stdscr, screen_y - 1, 1);
wrefresh (input); wrefresh (input);
#else
const char *cmd;
while (1) {
cmd = Sys_ConsoleInput ();
if (!cmd)
break;
Cbuf_AddText (cmd);
}
#endif
} }
#ifdef HAVE_CURSES_H
/* /*
Con_CompleteCommandLine Con_CompleteCommandLine
@ -403,3 +426,4 @@ Con_CompleteCommandLine (void)
if (list[i]) if (list[i])
free (list[i]); free (list[i]);
} }
#endif