From f3d0c0b3dc793dadf62a49e299749681da922c65 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 4 Aug 2004 06:31:51 +0000
Subject: [PATCH] Fix segfault with external programs when NOT running under
 curses... HOWEVER the chat stuff is terrible and needs fixing...  it
 basically needs a complete re-write for ciolib... I'll get around to it
 eventually...

---
 src/sbbs3/umonitor/chat.h     |  1 +
 src/sbbs3/umonitor/umonitor.c | 22 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/sbbs3/umonitor/chat.h b/src/sbbs3/umonitor/chat.h
index 4abcfa8cd1..3e1818b2bd 100644
--- a/src/sbbs3/umonitor/chat.h
+++ b/src/sbbs3/umonitor/chat.h
@@ -35,6 +35,7 @@
  * Note: If this box doesn't appear square, then you need to fix your tabs.	*
  ****************************************************************************/
 
+#undef getch
 #include <curses.h>
 
 typedef struct {
diff --git a/src/sbbs3/umonitor/umonitor.c b/src/sbbs3/umonitor/umonitor.c
index d21fdeb647..334a8c238d 100644
--- a/src/sbbs3/umonitor/umonitor.c
+++ b/src/sbbs3/umonitor/umonitor.c
@@ -35,9 +35,6 @@
  * Note: If this box doesn't appear square, then you need to fix your tabs.	*
  ****************************************************************************/
 
-#include "sbbs.h"
-#include "conwrap.h"	/* this has to go BEFORE curses.h so getkey() can be macroed around */
-#include <curses.h>
 #include <signal.h>
 #include <sys/types.h>
 #include <time.h>
@@ -47,6 +44,10 @@
 #endif
 #include <stdio.h>
 #include <unistd.h>
+
+#include "ciolib.h"
+#define __COLORS		/* Disable the colour macros in sbbsdefs.h ToDo */
+#include "sbbs.h"
 #include "genwrap.h"
 #include "uifc.h"
 #include "sbbsdefs.h"
@@ -520,10 +521,23 @@ int view_logs(scfg_t *cfg)
 int do_cmd(char *cmd)
 {
 	int i;
-	
+	struct text_info ti;
+	char *p;
+
+#if 0
 	endwin();
+#else
+	gettextinfo(&ti);
+	p=malloc(ti.screenheight*ti.screenwidth*2);
+	gettext(1,1,ti.screenwidth,ti.screenheight,p);
+#endif
 	i=system(cmd);
+#if 0
 	refresh();
+#else
+	puttext(1,1,ti.screenwidth,ti.screenheight,p);
+	free(p);
+#endif
 	return(i);
 }
 
-- 
GitLab