--- ./lib/perl5db.pl-pre	Tue Oct 28 20:08:16 2003
+++ ./lib/perl5db.pl	Thu Oct 30 11:34:32 2003
@@ -1326,23 +1326,20 @@ the debugger only handles X Windows and 
 =cut
 
 # Set up the get_fork_TTY subroutine to be aliased to the proper routine.
-# Works if you're running an xterm or xterm-like window, or you're on
-# OS/2. This may need some expansion: for instance, this doesn't handle
+# Samples available for starting an xterm or xterm-like window, or new sessions
+# os OS/2. This may need some expansion: for instance, this doesn't handle
 # OS X Terminal windows.       
 
-if (not defined &get_fork_TTY                        # no routine exists,
-    and defined $ENV{TERM}                           # and we know what kind
-                                                     # of terminal this is,
-    and $ENV{TERM} eq 'xterm'                        # and it's an xterm,
-    and defined $ENV{WINDOWID}                       # and we know what
-                                                     # window this is,
-    and defined $ENV{DISPLAY})                       # and what display it's
-                                                     # on,
-{
-    *get_fork_TTY = \&xterm_get_fork_TTY;            # use the xterm version
-} ## end if (not defined &get_fork_TTY...
-elsif ($^O eq 'os2') {                               # If this is OS/2,
-    *get_fork_TTY = \&os2_get_fork_TTY;              # use the OS/2 version
+if (not defined &get_fork_TTY) {
+  if (defined $ENV{PERLDB_FORCE} and $ENV{PERLDB_FORCE} =~ /\bxterm\b/ or
+      # check that xterm is installed somewhere
+      defined $ENV{TERM} and $ENV{TERM} eq 'xterm'
+      and defined $ENV{WINDOWID}		# and we on the same computer
+      and defined $ENV{DISPLAY}) {		# and X is not disabled
+    *get_fork_TTY = \&xterm_get_fork_TTY;	# use the xterm version
+  } elsif ($^O eq 'os2') {
+    *get_fork_TTY = \&os2_get_fork_TTY;		# VIO session via P_SESSION
+  }
 }
 
 # "Here begin the unreadable code.  It needs fixing." 
