* Disable any use of curses on Darwin (this is temporary until I beat
authorMichael Hampton <io_error@uncensored.citadel.org>
Sat, 19 Oct 2002 08:18:06 +0000 (08:18 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sat, 19 Oct 2002 08:18:06 +0000 (08:18 +0000)
  Apple's bizarre linker into submission)

citadel/ChangeLog
citadel/citadel.c
citadel/citadel_decls.h
citadel/commands.c
citadel/configure.ac
citadel/screen.c
citadel/screen.h
citadel/setup.c

index 943dd06bcf4dd2437a73b2c0e83cfeaf62c13b37..cc6638b45d0eacf7f52e4e8b3e10eaaae411dd88 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 10ebb3045b787e18b94c1776c54688099d246ba6..86548b3c5d7cff98b48f5cd0d33421f459969026 100644 (file)
@@ -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);
index dc36d75096ae7a4f9408abf9b3dbd872a5b554fb..edae28ae265cd9ea7f03a14efc655f0c455cba30 100644 (file)
@@ -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
index 4ae380c9433b67f7b8380affb7f0fc50f80d25e2..eb6dc1dc65d33bf6e0eb173af4af88f9d92c5f4f 100644 (file)
@@ -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
index 79e5cb3fc4050d2be834c85b27024f206487e8b2..d4c14cb2a079d447621229069e0f167018cba051 100644 (file)
@@ -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*)
index eed34541ddf28124399a1ff2eb5e2582966a5eb6..19f809b4f94ad2698025ce554f115895f1983663 100644 (file)
 #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;
index 3c47d710f28ad1e6e3ef2366c8d9f1d8a7f925dc..b6af74dc376e60c16a329dcfe14ab7fd2df64822 100644 (file)
@@ -2,11 +2,13 @@
 
 /* client code may need the ERR define: */
 
+#ifndef DISABLE_CURSES
 #ifdef HAVE_NCURSES_H
 #include <ncurses.h>
 #elif defined(HAVE_CURSES_H)
 #include <curses.h>
 #endif
+#endif
 
 void status_line(const char *humannode, const char *bbs_city,
                 const char *room_name, int secure, int newmailcount);
index 6269379b30bdff769c8619e4c4ae5e06570f594c..2ac06a8653a7941fcae21aec65bc91454328c997 100644 (file)
 #include "config.h"
 #include "tools.h"
 
+#ifndef DISABLE_CURSES
 #if defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H)
-
 #ifdef HAVE_NCURSES_H
 #include <ncurses.h>
 #else
 #include <curses.h>
 #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();