File kterm-6.2.0-glibc2.1.suse.diff of Package kterm

--- kterm-6.2.0.orig/main.c	Wed Dec 15 12:16:37 1999
+++ kterm-6.2.0/main.c	Thu Dec 16 10:43:34 1999
@@ -116,7 +116,7 @@
 static Bool IsPts = False;
 #endif
 
-#if defined(ATT) && !defined(__sgi)
+#if (defined(ATT) && !defined(__sgi)) || (defined(SYSV) && defined(i386)) || (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
 #define USE_USG_PTYS
 #else
 #define USE_HANDSHAKE
@@ -140,6 +140,9 @@
 #define HAS_UTMP_UT_HOST
 #define LASTLOG
 #define WTMP
+#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
+#include <pty.h>
+#endif
 #endif
 
 #include <sys/ioctl.h>
@@ -283,7 +286,15 @@
 #include <lastlog.h>
 # endif
 #endif
+
+/* Xpoll.h and <sys/param.h> on glibc 2.1 systems have colliding NBBY's */
+#if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
+#ifndef NOFILE
+#define NOFILE OPEN_MAX
+#endif
+#elif !defined(MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(__GNU__)
 #include <sys/param.h>	/* for NOFILE */
+#endif
 
 #ifdef  PUCC_PTYD
 #include <local/openpty.h>
@@ -1681,14 +1692,13 @@
  * has problems, we can re-enter this function and get another one.
  */
 
-get_pty (pty)
-    int *pty;
+static int
+get_pty (int *pty)
 {
-#ifdef __osf__
+#if defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS))
     int tty;
     return (openpty(pty, &tty, ttydev, NULL, NULL));
-#endif
-#if defined(SYSV) && defined(i386) && !defined(SVR4)
+#elif (defined(SYSV) && defined(i386) && !defined(SVR4)) || defined(__QNXNTO__)
         /*
 	  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
@@ -1714,20 +1724,27 @@
 	  */
         if (pty_search(pty) == 0)
 	    return 0;
-#endif /* SYSV && i386 && !SVR4 */
-#if defined(ATT) && !defined(__sgi)
+#elif defined(USE_USG_PTYS)
+#ifdef __GLIBC__ /* if __GLIBC__ and USE_USG_PTYS, we know glibc >= 2.1 */
+	/* GNU libc 2 allows us to abstract away from having to know the
+	   master pty device name. */
+	if ((*pty = getpt()) < 0) {
+	    return 1;
+	}
+	strcpy(ttydev, ptsname(*pty));
+#else
 	if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) {
 	    return 1;
 	}
-#if defined(SVR4) || defined(i386)
+#endif
+#if defined(SVR4) || defined(SCO325) || (defined(i386) && defined(SYSV))
 	strcpy(ttydev, ptsname(*pty));
 #if defined (SYSV) && defined(i386) && !defined(SVR4)
 	IsPts = True;
 #endif
 #endif
 	return 0;
-#else /* ATT else */
-#ifdef AIXV3
+#elif defined( AIXV3)
 	if ((*pty = open ("/dev/ptc", O_RDWR)) < 0) {
 	    return 1;
 	}
@@ -1786,7 +1803,6 @@
 
 #endif /* __sgi or umips else */
 #endif /* USE_GET_PSEUDOTTY else */
-#endif /* ATT else */
 }
 
 /*
@@ -2369,6 +2385,7 @@
 		if ((ptyfd = open (ptsname(screen->respond), O_RDWR)) < 0) {
 		    SysError (1);
 		}
+#ifdef I_PUSH
 		if (ioctl (ptyfd, I_PUSH, "ptem") < 0) {
 		    SysError (2);
 		}
@@ -2385,6 +2402,7 @@
 		    SysError (5);
 		}
 #endif /* SVR4 */
+#endif /* I_PUSH */
 		tty = ptyfd;
 		close (screen->respond);
 #ifdef TIOCSWINSZ
@@ -2447,12 +2465,12 @@
 #endif
 #endif /* USE_SYSV_PGRP */
 		while (1) {
-#ifdef TIOCNOTTY
+#if defined(TIOCNOTTY) && !((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
 			if (!no_dev_tty && (tty = open ("/dev/tty", O_RDWR)) >= 0) {
 				ioctl (tty, TIOCNOTTY, (char *) NULL);
 				close (tty);
 			}
-#endif /* TIOCNOTTY */
+#endif /* TIOCNOTTY && !glibc >=2.1 */
 			if ((tty = open(ttydev, O_RDWR, 0)) >= 0) {
 #if defined(CRAY) && defined(TCSETCTTY)
 			    /* make /dev/tty work */
@@ -2954,7 +2972,7 @@
 
 		/* set up the new entry */
 		utmp.ut_type = USER_PROCESS;
-#ifndef linux
+#if !(defined(linux) && (!defined(__GLIBC__) || (__GLIBC__ < 2))) && !defined(SVR4)
 		utmp.ut_exit.e_exit = 2;
 #endif
 		(void) strncpy(utmp.ut_user,
@@ -2986,7 +3004,7 @@
 			       sizeof(utmp.ut_name));
 
 		utmp.ut_pid = getpid();
-#ifdef SVR4
+#if defined(SVR4) || defined(SCO325) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2))
 		utmp.ut_session = getsid(0);
 		utmp.ut_xtime = time ((Time_t *) 0);
 		utmp.ut_tv.tv_usec = 0;
@@ -2998,9 +3016,12 @@
 		if (!resource.utmpInhibit)
 		    (void) pututline(&utmp);
 #ifdef WTMP
-#ifdef SVR4
+#if defined(SVR4) || defined(SCO325)
 		if (term->misc.login_shell)
 		    updwtmpx(WTMPX_FILE, &utmp);
+#elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2)
+		if (term->misc.login_shell)
+		    updwtmp(etc_wtmp, &utmp);
 #else
 		if (term->misc.login_shell &&
 		     (i = open(etc_wtmp, O_WRONLY|O_APPEND)) >= 0) {
@@ -3409,7 +3430,7 @@
 #endif
 	char* ptyname;
 	char* ptynameptr;
-#if defined(WTMP) && !defined(SVR4)
+#if defined(WTMP) && !defined(SVR4) && !(defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2))
 	int fd;			/* for /etc/wtmp */
 	int i;
 #endif
@@ -3441,7 +3462,7 @@
 	    /* write it out only if it exists, and the pid's match */
 	    if (utptr && (utptr->ut_pid == screen->pid)) {
 		    utptr->ut_type = DEAD_PROCESS;
-#ifdef SVR4
+#if defined(SVR4) || defined(SCO325) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2))
 		    utmp.ut_session = getsid(0);
 		    utmp.ut_xtime = time ((Time_t *) 0);
 		    utmp.ut_tv.tv_usec = 0;
@@ -3450,12 +3471,18 @@
 #endif
 		    (void) pututline(utptr);
 #ifdef WTMP
-#ifdef SVR4
-		    updwtmpx(WTMPX_FILE, &utmp);
+#if defined(SVR4) || defined(SCO325)
+		    if (term->misc.login_shell)
+			updwtmpx(WTMPX_FILE, utptr);
+#elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2)
+		    strncpy (utmp.ut_line, utptr->ut_line, sizeof (utmp.ut_line));
+		    if (term->misc.login_shell)
+			updwtmp(etc_wtmp, utptr);
 #else
 		    /* set wtmp entry if wtmp file exists */
-		    if ((fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
-		      i = write(fd, utptr, sizeof(utmp));
+		    if (term->misc.login_shell &&
+			(fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
+		      i = write(fd, utptr, sizeof(*utptr));
 		      i = close(fd);
 		    }
 #endif
--- kterm-6.2.0.orig/screen.c	Wed Dec 15 13:53:53 1999
+++ kterm-6.2.0/screen.c	Wed Dec 15 13:58:00 1999
@@ -40,13 +40,21 @@
 #include <sys/ioctl.h>
 #endif
 
-#ifdef att
+#ifdef SYSV
+#if !defined(DGUX)    /* Intel DG/ux uses termios.h */
 #include <sys/termio.h>
+#endif /* DGUX */
+#ifdef USE_USG_PTYS
 #include <sys/stream.h>			/* get typedef used in ptem.h */
 #include <sys/ptem.h>
 #endif
+#endif
+
+#ifndef __malloc_and_calloc_defined
+extern Char *calloc(), *malloc();
+#endif
 
-extern Char *calloc(), *malloc(), *realloc();
+extern Char *realloc();
 extern void free();
 
 ScrnBuf Allocate (nrow, ncol, addr)
--- kterm-6.2.0.orig/ptyx.h	Wed Dec 15 13:26:11 1999
+++ kterm-6.2.0/ptyx.h	Wed Dec 15 13:58:32 1999
@@ -81,7 +81,7 @@
 #ifdef hpux
 #define TTYDEV		"/dev/pty/ttyxx"
 #else	/* !hpux */
-#ifdef __osf__
+#if defined(__osf__) || (defined(linux) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1))
 #define TTYDEV		"/dev/ttydirs/xxx/xxxxxxxxxxxxxx"
 #else
 #define	TTYDEV		"/dev/ttyxx"
--- kterm-6.2.0.orig/scrollbar.c Tue Jan 25 15:46:30 2000
+++ kterm-6.2.0/scrollbar.c	Tue Dec 14 17:26:29 1999
@@ -324,7 +324,10 @@
 	register TScreen *screen = &xw->screen;
 	register int border = 2 * screen->border;
 	register int i;
+
+#ifndef __malloc_and_calloc_defined
 	Char *realloc(), *calloc();
+#endif
 
 	if(screen->scrollbar)
 		return;
openSUSE Build Service is sponsored by