$NetBSD: patch-ab,v 1.1 2005/11/10 18:25:42 joerg Exp $

--- vtmouse.c.orig	2005-11-10 18:18:59.000000000 +0000
+++ vtmouse.c
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
 #endif
 
 /* I/O streams default to stdin and stdout. */
-FILE *xt_input=stdin, *xt_output=stdout;
+FILE *xt_input = NULL, *xt_output = NULL;
 static int have_xterm=0;
 static int set_title=0;
 static char *old_title=NULL;
@@ -118,6 +118,9 @@ static char *get_xtitle()
 static void set_xtitle(titlebar)
 char *titlebar;
 {
+	if (xt_output == NULL)
+		xt_output = stdout;
+
 	fprintf(xt_output, "\033]0;%s\07", titlebar);
 	fflush(xt_output);
 }
@@ -166,6 +169,11 @@ struct event *X_event;
 	window *thiswin;
 #endif
 
+	if (xt_input == NULL)
+		xt_input = stdin;
+	if (xt_output == NULL)
+		xt_output = stdout;
+
 	X_event->happening=0;
 
 	if ( have_xterm ) {
@@ -277,6 +285,9 @@ struct event *X_event;
 
 void event_quit()
 {
+	if (xt_output == NULL)
+		xt_output = stdout;
+
 	if ( have_xterm ) {
 #ifdef REPORT_SELECTION
 		fprintf(xt_output, "\033[?1001l");
