$NetBSD: patch-aa,v 1.1.1.1 2001/06/23 21:52:08 frueauf Exp $

--- pconsole.sh.in.orig	Mon Apr  9 10:59:48 2001
+++ pconsole.sh.in	Sat Jun 23 23:29:24 2001
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/ksh
 #
 #   pconsole WJ101
 #   Copyright (C) 2001  Walter de Jong <walter@heiho.net>
@@ -31,12 +31,21 @@
 	set -x
 fi
 
-PATH=/bin:/usr/bin:/usr/bin/X11:/usr/openwin/bin:/usr/local/bin:/usr/bsd:/usr/share/bin:/opt/bin:/etc:/usr/etc
+PATH=/bin:/usr/bin:@PREFIX@/bin:@X11PREFIX@/bin:/usr/bin/X11:/usr/openwin/bin:/usr/local/bin:/usr/bsd:/usr/share/bin:/opt/bin:/etc:/usr/etc
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 bindir=@bindir@
 
+OS=`uname -s`
+
+if [ "${OS}" = "NetBSD" ];
+then
+	TTYEXT='tty'
+else
+	TTYEXT=''
+fi
+
 #
 #	options: you can overrule these by setting them in your environment
 #
@@ -46,7 +55,7 @@
 fi
 if [ -z "${P_TERM_OPTIONS}" ]
 then
-	P_TERM_OPTIONS="-geometry 40x12 -fn 5x7"
+	P_TERM_OPTIONS="-geometry 80x24 -fn 5x7"
 fi
 if [ -z "${P_CONNECT_CMD}" ]
 then
@@ -73,7 +82,12 @@
 	fi
 
 	PS_PERSONALITY=posix		# may be needed for GNU ps :P
-	ps -ef 2>/dev/null | awk '{ print $3 " " $6 }' | egrep "^$1" | awk '{ print $2 }'
+	if [ "${OS}" = "NetBSD" ];
+        then
+		ps j 2>/dev/null | awk '{ print $3 " " $8 }' | egrep "^$1" | awk '{ print $2 }'
+	else
+		ps -ef 2>/dev/null | awk '{ print $3 " " $6 }' | egrep "^$1" | awk '{ print $2 }'
+	fi
 }
 
 
@@ -127,7 +141,7 @@
 
 # sometimes xterm is too slow forking off, and get_tty will give the same
 # tty as we started from. This would be incorrect, and if so, we try again
-			if [ "/dev/${TTY}" = "${THIS_TTY}" ];
+			if [ "/dev/${TTYEXT}${TTY}" = "${THIS_TTY}" ];
 			then
 				TTY=''
 				sleep 1
@@ -138,9 +152,9 @@
 		HOSTLIST=`echo ${HOSTLIST} | cut -d\  -f2-999`
 		if [ ! -z "${HOST}" ]
 		then
-			TTYS="${TTYS} ${HOST}#/dev/${TTY}"
+			TTYS="${TTYS} ${HOST}#/dev/${TTYEXT}${TTY}"
 		else
-			TTYS="${TTYS} /dev/${TTY}"
+			TTYS="${TTYS} /dev/${TTYEXT}${TTY}"
 		fi
 	done