From c215de86120c74d1f2738da90ff2b912b295f690 Mon Sep 17 00:00:00 2001 From: Michael Hampton Date: Sat, 19 Oct 2002 08:18:06 +0000 Subject: [PATCH] * Disable any use of curses on Darwin (this is temporary until I beat Apple's bizarre linker into submission) --- citadel/ChangeLog | 5 +++++ citadel/citadel.c | 6 ++--- citadel/citadel_decls.h | 2 +- citadel/commands.c | 8 ++++--- citadel/configure.ac | 4 ++++ citadel/screen.c | 50 ++++++++++++++++++++--------------------- citadel/screen.h | 2 ++ citadel/setup.c | 22 +++++++++--------- 8 files changed, 56 insertions(+), 43 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 943dd06bc..cc6638b45 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 601.37 2002/10/19 08:18:06 error + * Disable any use of curses on Darwin (this is temporary until I beat + Apple's bizarre linker into submission) + Revision 601.36 2002/10/18 10:33:09 error * More signed/unsigned fixes (for the new progress gauge) @@ -4109,3 +4113,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citadel.c b/citadel/citadel.c index 10ebb3045..86548b3c5 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -949,7 +949,7 @@ int main(int argc, char **argv) #ifdef HAVE_OPENSSL arg_encrypt = RC_DEFAULT; #endif -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) arg_screen = RC_DEFAULT; #endif @@ -978,13 +978,13 @@ int main(int argc, char **argv) #endif } if (!strcmp(argv[a], "-s")) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) arg_screen = RC_NO; #endif argc = shift(argc, argv, a, 1); } if (!strcmp(argv[a], "-S")) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) arg_screen = RC_YES; #endif argc = shift(argc, argv, a, 1); diff --git a/citadel/citadel_decls.h b/citadel/citadel_decls.h index dc36d7509..edae28ae2 100644 --- a/citadel/citadel_decls.h +++ b/citadel/citadel_decls.h @@ -18,7 +18,7 @@ extern time_t rc_idle_threshold; extern char rc_encrypt; /* from the citadel.rc file */ extern char arg_encrypt; /* from the command line */ #endif -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) extern char rc_screen; extern char arg_screen; #endif diff --git a/citadel/commands.c b/citadel/commands.c index 4ae380c94..eb6dc1dc6 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -499,9 +499,11 @@ int inkey(void) && ((a < 32) || (a > 126))) a = 0; +#ifndef DISABLE_CURSES #if defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H) if (a == ERR) a = 0; +#endif #endif } while (a == 0); @@ -741,7 +743,7 @@ void load_command_set(void) #ifdef HAVE_OPENSSL rc_encrypt = RC_DEFAULT; #endif -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) rc_screen = RC_DEFAULT; #endif rc_alt_semantics = 0; @@ -790,7 +792,7 @@ void load_command_set(void) #endif } -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (!strncasecmp(buf, "fullscreen=", 11)) { if (!strcasecmp(&buf[11], "yes")) rc_screen = RC_YES; @@ -1439,7 +1441,7 @@ void color(int colornum) current_color = colornum; if (enable_color) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (scr_color(colornum)) return; #endif diff --git a/citadel/configure.ac b/citadel/configure.ac index 79e5cb3fc..d4c14cb2a 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -74,6 +74,10 @@ case "$host" in *-*-bsdi*) AC_DEFINE(HAVE_NONREENTRANT_NETDB) ;; + dnl Curses support on Mac OS X is kind of screwed at the moment. + *-*-darwin*) + AC_DEFINE(DISABLE_CURSES) + ;; dnl Digital Unix has an odd way to build for pthreads, and we can't dnl build pthreads programs with gcc due to header problems. alpha*-dec-osf*) diff --git a/citadel/screen.c b/citadel/screen.c index eed34541d..19f809b4f 100644 --- a/citadel/screen.c +++ b/citadel/screen.c @@ -26,25 +26,25 @@ #include "citadel_decls.h" #include "commands.h" -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) static SCREEN *myscreen = NULL; static WINDOW *mainwindow = NULL; static WINDOW *statuswindow = NULL; char rc_screen; char arg_screen; +#endif extern int screenheight; extern int screenwidth; extern int rc_ansi_color; extern void check_screen_dims(void); -#endif void do_keepalive(void); int is_curses_enabled(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) return mainwindow != NULL; #else return 0; @@ -58,7 +58,7 @@ int is_curses_enabled(void) { void status_line(const char *humannode, const char *bbs_city, const char *room_name, int secure, int newmailcount) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (statuswindow) { if (secure) { sln_printf("Encrypted "); @@ -85,7 +85,7 @@ void status_line(const char *humannode, const char *bbs_city, */ void screen_new(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (arg_screen != RC_NO && rc_screen != RC_NO) myscreen = newterm(NULL, stdout, stdin); if (myscreen) { @@ -130,7 +130,7 @@ void screen_delete(void) { windows_delete(); screen_reset(); -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (myscreen) delscreen(myscreen); myscreen = NULL; @@ -144,7 +144,7 @@ void screen_delete(void) */ int screen_set(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (myscreen) { set_term(myscreen); wrefresh(curscr); @@ -160,7 +160,7 @@ int screen_set(void) */ int screen_reset(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (myscreen) { endwin(); return 1; @@ -179,7 +179,7 @@ int scr_printf(char *fmt, ...) register int retval; va_start(ap, fmt); -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) { retval = _vwprintw(mainwindow, fmt, ap); } else @@ -199,7 +199,7 @@ int err_printf(char *fmt, ...) register int retval; va_start(ap, fmt); -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) { /* FIXME: direct to error window */ retval = _vwprintw(mainwindow, fmt, ap); if (fmt[strlen(fmt) - 1] == '\n') @@ -219,12 +219,12 @@ int sln_printf(char *fmt, ...) { va_list ap; register int retval; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) static char buf[4096]; #endif va_start(ap, fmt); -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (statuswindow) { register char *i; @@ -252,7 +252,7 @@ int sln_printf(char *fmt, ...) int sln_printf_if(char *fmt, ...) { register int retval = 1; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) static char buf[4096]; va_list ap; @@ -281,7 +281,7 @@ int scr_getc(int delay) { unsigned char buf; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) { wtimeout(mainwindow, delay); return wgetch(mainwindow); @@ -301,7 +301,7 @@ int scr_getc(int delay) int scr_blockread(void) { int a = 0; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) wtimeout(mainwindow, S_KEEPALIVE); while (1) { @@ -321,7 +321,7 @@ int scr_blockread(void) */ int scr_putc(int c) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) { if (c == 7) beep(); return ((waddch(mainwindow, c) == OK) ? c : EOF); @@ -333,7 +333,7 @@ int scr_putc(int c) int sln_putc(int c) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (statuswindow) return ((waddch(statuswindow, c) == OK) ? c : EOF); #endif @@ -343,7 +343,7 @@ int sln_putc(int c) int sln_putc_if(int c) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (statuswindow) return ((waddch(statuswindow, c) == OK) ? c : EOF); #endif @@ -356,7 +356,7 @@ int sln_putc_if(int c) */ int scr_color(int colornum) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) { #ifdef HAVE_WCOLOR_SET wcolor_set(mainwindow, (colornum & 7), NULL); @@ -377,7 +377,7 @@ int scr_color(int colornum) void scr_flush(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) wrefresh(mainwindow); else @@ -388,7 +388,7 @@ void scr_flush(void) void err_flush(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) /* FIXME: error status window needed */ wrefresh(mainwindow); else @@ -399,7 +399,7 @@ void err_flush(void) void sln_flush(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (statuswindow) wrefresh(statuswindow); else @@ -414,7 +414,7 @@ static volatile int caught_sigwinch = 0; */ int scr_set_windowsize() { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow && caught_sigwinch) { caught_sigwinch = 0; #ifdef HAVE_RESIZETERM @@ -456,7 +456,7 @@ RETSIGTYPE scr_winch(int signum) */ void windows_new(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) register int x, y; if (myscreen) { @@ -491,7 +491,7 @@ void windows_new(void) */ void windows_delete(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (mainwindow) delwin(mainwindow); mainwindow = NULL; diff --git a/citadel/screen.h b/citadel/screen.h index 3c47d710f..b6af74dc3 100644 --- a/citadel/screen.h +++ b/citadel/screen.h @@ -2,11 +2,13 @@ /* client code may need the ERR define: */ +#ifndef DISABLE_CURSES #ifdef HAVE_NCURSES_H #include #elif defined(HAVE_CURSES_H) #include #endif +#endif void status_line(const char *humannode, const char *bbs_city, const char *room_name, int secure, int newmailcount); diff --git a/citadel/setup.c b/citadel/setup.c index 6269379b3..2ac06a865 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -26,14 +26,14 @@ #include "config.h" #include "tools.h" +#ifndef DISABLE_CURSES #if defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H) - #ifdef HAVE_NCURSES_H #include #else #include #endif - +#endif #endif #define MAXSETUP 3 /* How many setup questions to ask */ @@ -236,7 +236,7 @@ void start_the_service(void) { void cleanup(int exitcode) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (setup_type == UI_CURSES) { clear(); refresh(); @@ -252,7 +252,7 @@ void cleanup(int exitcode) /* Where on the screen to start */ /* Pointer to string buffer */ /* Maximum length - if negative, no-show */ -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) void getlin(int yp, int xp, char *string, int lim) { int a, b; char flag; @@ -324,7 +324,7 @@ void hit_any_key(void) { char junk[5]; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (setup_type == UI_CURSES) { mvprintw(20, 0, "Press any key to continue... "); refresh(); @@ -357,7 +357,7 @@ int yesno(char *question) } while ((answer < 0) || (answer > 1)); break; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) case UI_CURSES: do { clear(); @@ -394,7 +394,7 @@ void important_message(char *title, char *msgtext) hit_any_key(); break; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) case UI_CURSES: clear(); move(1, 20); @@ -450,7 +450,7 @@ void progress(char *text, long int curr, long int cmax) } break; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) case UI_CURSES: if (curr == 0) { clear(); @@ -593,7 +593,7 @@ void set_str_val(int msgpos, char str[]) if (strlen(buf) != 0) strcpy(str, buf); break; -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) case UI_CURSES: clear(); move(1, ((80 - strlen(setup_titles[msgpos])) / 2)); @@ -690,7 +690,7 @@ void write_config_to_disk(void) int discover_ui(void) { -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) return UI_CURSES; #endif return UI_TEXT; @@ -738,7 +738,7 @@ int main(int argc, char *argv[]) if (setup_type < 0) { setup_type = discover_ui(); } -#ifdef HAVE_CURSES_H +#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (setup_type == UI_CURSES) { initscr(); raw(); -- 2.39.2