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 :-)
This commit is contained in:
christos 2011-03-07 00:27:51 +00:00
parent e73fcb7199
commit 959ab2631c
2 changed files with 16 additions and 7 deletions

View File

@ -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. .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd December 7, 2009 .Dd March 6, 2011
.Dt TERMCAP 3 .Dt TERMCAP 3
.Os .Os
.Sh NAME .Sh NAME
@ -124,7 +124,13 @@ function returns a cursor addressing string decoded from
to go to column to go to column
.Fa destcol .Fa destcol
in line in line
.Fa destline . .Fa destline ,
or
.Dq OOPS
if it could not decode
a
.Dv %
sequence.
.Sh SEE ALSO .Sh SEE ALSO
.Xr terminfo 3 , .Xr terminfo 3 ,
.Xr terminfo 5 .Xr terminfo 5

View File

@ -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. * Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
*/ */
#include <sys/cdefs.h> #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 <assert.h>
#include <ctype.h> #include <ctype.h>
@ -178,9 +178,12 @@ tgetstr(const char *id, char **area)
char * char *
tgoto(const char *cm, int destcol, int destline) tgoto(const char *cm, int destcol, int destline)
{ {
static char OOPS[] = "OOPS";
char *p;
_DIAGASSERT(cm != NULL); _DIAGASSERT(cm != NULL);
return vtparm(cm, destline, destcol); p = vtparm(cm, destline, destcol);
return p ? p : OOPS;
} }
static const char * static const char *