Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libterminfo Restore historical behavior of tgoto() to re...



details:   https://anonhg.NetBSD.org/src/rev/d86048ba8ef7
branches:  trunk
changeset: 762980:d86048ba8ef7
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 07 00:27:51 2011 +0000

description:
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 :-)

diffstat:

 lib/libterminfo/termcap.3 |  12 +++++++++---
 lib/libterminfo/termcap.c |  11 +++++++----
 2 files changed, 16 insertions(+), 7 deletions(-)

diffs (66 lines):

diff -r 73d2f993f1f6 -r d86048ba8ef7 lib/libterminfo/termcap.3
--- a/lib/libterminfo/termcap.3 Sun Mar 06 23:41:47 2011 +0000
+++ b/lib/libterminfo/termcap.3 Mon Mar 07 00:27:51 2011 +0000
@@ -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
diff -r 73d2f993f1f6 -r d86048ba8ef7 lib/libterminfo/termcap.c
--- a/lib/libterminfo/termcap.c Sun Mar 06 23:41:47 2011 +0000
+++ b/lib/libterminfo/termcap.c Mon Mar 07 00:27:51 2011 +0000
@@ -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 *



Home | Main Index | Thread Index | Old Index