Module Name:    src
Committed By:   christos
Date:           Mon Mar  7 00:27:52 UTC 2011

Modified Files:
        src/lib/libterminfo: termcap.3 termcap.c

Log Message:
Restore historical behavior of tgoto() to return "OOPS" on failure. This is
best for now because there are too many programs that don't check the return
value of it. Of course cursor motion commands from $TERMCAP have 0 chance
of working now, since their % escapes are not translated to terminfo. In
the window case %+ expects one param from the stack in the termcap case
and two in the terminfo so we barf. We need proper captoinfo handling for
the % escapes, like the one in ncurses. Hi Roy :-)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/termcap.3
cvs rdiff -u -r1.10 -r1.11 src/lib/libterminfo/termcap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libterminfo/termcap.3
diff -u src/lib/libterminfo/termcap.3:1.4 src/lib/libterminfo/termcap.3:1.5
--- src/lib/libterminfo/termcap.3:1.4	Thu Feb  4 04:12:55 2010
+++ src/lib/libterminfo/termcap.3	Sun Mar  6 19:27:51 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: termcap.3,v 1.4 2010/02/04 09:12:55 wiz Exp $
+.\"	$NetBSD: termcap.3,v 1.5 2011/03/07 00:27:51 christos Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 7, 2009
+.Dd March 6, 2011
 .Dt TERMCAP 3
 .Os
 .Sh NAME
@@ -124,7 +124,13 @@
 to go to column
 .Fa destcol
 in line
-.Fa destline .
+.Fa destline ,
+or
+.Dq OOPS
+if it could not decode
+a
+.Dv %
+sequence.
 .Sh SEE ALSO
 .Xr terminfo 3 ,
 .Xr terminfo 5

Index: src/lib/libterminfo/termcap.c
diff -u src/lib/libterminfo/termcap.c:1.10 src/lib/libterminfo/termcap.c:1.11
--- src/lib/libterminfo/termcap.c:1.10	Tue Oct 12 08:49:27 2010
+++ src/lib/libterminfo/termcap.c	Sun Mar  6 19:27:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: termcap.c,v 1.10 2010/10/12 12:49:27 christos Exp $ */
+/* $NetBSD: termcap.c,v 1.11 2011/03/07 00:27:51 christos Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: termcap.c,v 1.10 2010/10/12 12:49:27 christos Exp $");
+__RCSID("$NetBSD: termcap.c,v 1.11 2011/03/07 00:27:51 christos Exp $");
 
 #include <assert.h>
 #include <ctype.h>
@@ -178,9 +178,12 @@
 char *
 tgoto(const char *cm, int destcol, int destline)
 {
-	
+	static char OOPS[] = "OOPS";	
+	char *p;
+
 	_DIAGASSERT(cm != NULL);
-	return vtparm(cm, destline, destcol);
+	p = vtparm(cm, destline, destcol);
+	return p ? p : OOPS;
 }
 
 static const char *

Reply via email to