# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# ROCK Linux: rock-src/package/blindcoder/kterm/kterm-devfs-aware.patch
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
# 
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
# 
# --- ROCK-COPYRIGHT-NOTE-END ---

diff -pruN kterm-6.2.0/Imakefile kterm-6.2.0_new/Imakefile
--- kterm-6.2.0/Imakefile	1996-07-12 07:01:04.000000000 +0200
+++ kterm-6.2.0_new/Imakefile	2003-08-16 15:23:27.000000000 +0200
@@ -21,8 +21,9 @@ XCOMM $Id: Imakefile,v 6.3 1996/07/12 05
 #endif
 #if UsePUCCPtyd			/* turn on in config/site.def */
     PUCCPTYDDEF = -DPUCC_PTYD		/* does not need to be setuid */
-         PTYLIB = -lpucc
+         PTYLIBN = -lpucc
 #endif
+PTYLIB = $(PTYLIBN) -lutil
 
  OSMAJORVERSION = OSMajorVersion
  OSMINORVERSION = OSMinorVersion
diff -pruN kterm-6.2.0/main.c kterm-6.2.0_new/main.c
--- kterm-6.2.0/main.c	2003-08-16 15:25:26.000000000 +0200
+++ kterm-6.2.0_new/main.c	2003-08-16 15:19:35.000000000 +0200
@@ -286,6 +286,7 @@ extern struct utmp *getutid __((struct u
 #endif
 #include <sys/param.h>	/* for NOFILE */
 
+#include <pty.h>
 #ifdef  PUCC_PTYD
 #include <local/openpty.h>
 int	Ptyfd;
@@ -1681,109 +1682,8 @@ char *name;
 get_pty (pty)
     int *pty;
 {
-#ifdef __osf__
     int tty;
     return (openpty(pty, &tty, ttydev, NULL, NULL));
-#endif
-#if defined(SYSV) && defined(i386) && !defined(SVR4)
-        /*
-	  The order of this code is *important*.  On SYSV/386 we want to open
-	  a /dev/ttyp? first if at all possible.  If none are available, then
-	  we'll try to open a /dev/pts??? device.
-	  
-	  The reason for this is because /dev/ttyp? works correctly, where
-	  as /dev/pts??? devices have a number of bugs, (won't update
-	  screen correcly, will hang -- it more or less works, but you
-	  really don't want to use it).
-	  
-	  Most importantly, for boxes of this nature, one of the major
-	  "features" is that you can emulate a 8086 by spawning off a UNIX
-	  program on 80386/80486 in v86 mode.  In other words, you can spawn
-	  off multiple MS-DOS environments.  On ISC the program that does
-	  this is named "vpix."  The catcher is that "vpix" will *not* work
-	  with a /dev/pts??? device, will only work with a /dev/ttyp? device.
-	  
-	  Since we can open either a /dev/ttyp? or a /dev/pts??? device,
-	  the flag "IsPts" is set here so that we know which type of
-	  device we're dealing with in routine spawn().  That's the reason
-	  for the "if (IsPts)" statement in spawn(); we have two different
-	  device types which need to be handled differently.
-	  */
-        if (pty_search(pty) == 0)
-	    return 0;
-#endif /* SYSV && i386 && !SVR4 */
-#if defined(ATT) && !defined(__sgi)
-	if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) {
-	    return 1;
-	}
-#if defined(SVR4) || defined(i386)
-	strcpy(ttydev, ptsname(*pty));
-#if defined (SYSV) && defined(i386) && !defined(SVR4)
-	IsPts = True;
-#endif
-#endif
-	return 0;
-#else /* ATT else */
-#ifdef AIXV3
-	if ((*pty = open ("/dev/ptc", O_RDWR)) < 0) {
-	    return 1;
-	}
-	strcpy(ttydev, ttyname(*pty));
-	return 0;
-#endif
-#if defined(__sgi) && OSMAJORVERSION >= 4
-	{
-	    char    *tty_name;
-
-	    tty_name = _getpty (pty, O_RDWR, 0622, 0);
-	    if (tty_name == 0)
-		return 1;
-	    strcpy (ttydev, tty_name);
-	    return 0;
-	}
-#endif
-#ifdef __convex__
-        {
-	    char *pty_name, *getpty();
-
-	    while ((pty_name = getpty()) != NULL) {
-		if ((*pty = open (pty_name, O_RDWR)) >= 0) {
-		    strcpy(ptydev, pty_name);
-		    strcpy(ttydev, pty_name);
-		    ttydev[5] = 't';
-		    return 0;
-		}
-	    }
-	    return 1;
-	}
-#endif /* __convex__ */
-#ifdef USE_GET_PSEUDOTTY
-	return ((*pty = getpseudotty (&ttydev, &ptydev)) >= 0 ? 0 : 1);
-#else
-#if (defined(__sgi) && OSMAJORVERSION < 4) || (defined(umips) && defined (SYSTYPE_SYSV))
-	struct stat fstat_buf;
-
-	*pty = open ("/dev/ptc", O_RDWR);
-	if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0) {
-	  return(1);
-	}
-	sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev));
-#ifndef __sgi
-	sprintf (ptydev, "/dev/ptyq%d", minor(fstat_buf.st_rdev));
-	if ((*tty = open (ttydev, O_RDWR)) < 0) {
-	  close (*pty);
-	  return(1);
-	}
-#endif /* !__sgi */
-	/* got one! */
-	return(0);
-#else /* __sgi or umips */
-
-	return pty_search(pty);
-
-#endif /* __sgi or umips else */
-#endif /* USE_GET_PSEUDOTTY else */
-#endif /* ATT else */
 }
 
 /*