svn commit: lorikeet r376 - in trunk/heimdal/lib/editline: .

lha at samba.org lha at samba.org
Fri Jul 8 18:45:09 GMT 2005


Author: lha
Date: 2005-07-08 18:45:08 +0000 (Fri, 08 Jul 2005)
New Revision: 376

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=376

Log:
1.15:  (TTYinfo): only call tgetent if we found it using autoconf

Modified:
   trunk/heimdal/lib/editline/editline.c


Changeset:
Modified: trunk/heimdal/lib/editline/editline.c
===================================================================
--- trunk/heimdal/lib/editline/editline.c	2005-07-08 05:18:30 UTC (rev 375)
+++ trunk/heimdal/lib/editline/editline.c	2005-07-08 18:45:08 UTC (rev 376)
@@ -25,7 +25,7 @@
 #include <ctype.h>
 #include <errno.h>
 
-RCSID("$Id: editline.c,v 1.14 2005/06/16 17:14:51 lha Exp $");
+RCSID("$Id: editline.c,v 1.15 2005/07/07 20:55:18 lha Exp $");
 
 /*
 **  Manifest constants.
@@ -217,10 +217,6 @@
 TTYinfo(void)
 {
     static int		init;
-    const char		*term;
-    char		buff[2048];
-    char		*bp;
-    char		*tmp;
 #if	defined(TIOCGWINSZ)
     struct winsize	W;
 #endif	/* defined(TIOCGWINSZ) */
@@ -238,20 +234,28 @@
     }
     init++;
 
-    TTYwidth = TTYrows = 0;
-    bp = &buff[0];
-    if ((term = getenv("TERM")) == NULL)
-	term = "dumb";
-    if (tgetent(buff, term) < 0) {
-       TTYwidth = SCREEN_WIDTH;
-       TTYrows = SCREEN_ROWS;
-       return;
+#ifdef HAVE_TGETENT
+    {
+	char		buff[2048];
+	char		*tmp;
+	char		*bp;
+	const char	*term;
+
+	TTYwidth = TTYrows = 0;
+	bp = &buff[0];
+	if ((term = getenv("TERM")) == NULL)
+	    term = "dumb";
+	if (tgetent(buff, term) >= 0) {
+	    
+	    tmp = tgetstr("le", &bp);
+	    if (tmp != NULL)
+		backspace = strdup(tmp);
+	    TTYwidth = tgetnum("co");
+	    TTYrows = tgetnum("li");
+	    return;
+	}
     }
-    tmp = tgetstr("le", &bp);
-    if (tmp != NULL)
-	backspace = strdup(tmp);
-    TTYwidth = tgetnum("co");
-    TTYrows = tgetnum("li");
+#endif
 
 #if	defined(TIOCGWINSZ)
     if (ioctl(0, TIOCGWINSZ, &W) >= 0) {



More information about the samba-cvs mailing list