SuSv2 mandates that tputs should return int instead of void.

This commit is contained in:
roy 2009-06-13 19:23:22 +00:00
parent 5fb0a3a4d7
commit f388a1765a
3 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: termcap.3,v 1.34 2009/03/03 07:37:48 wiz Exp $
.\" $NetBSD: termcap.3,v 1.35 2009/06/13 19:23:22 roy Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)termcap.3 8.2 (Berkeley) 12/11/93
.\"
.Dd March 2, 2009
.Dd June 13, 2009
.Dt TERMCAP 3
.Os
.Sh NAME
@ -59,7 +59,7 @@
.Fn tgetstr "const char *id" "char **area"
.Ft char *
.Fn tgoto "const char *cm" "int destcol" "int destline"
.Ft void
.Ft int
.Fn tputs "const char *cp" "int affcnt" "int (*outc)(int)"
.Ft int
.Fn t_getent "struct tinfo **info" "const char *name"

View File

@ -1,4 +1,4 @@
/* $NetBSD: termcap.h,v 1.15 2005/02/04 15:52:08 perry Exp $ */
/* $NetBSD: termcap.h,v 1.16 2009/06/13 19:23:22 roy Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@ char *tgetstr(const char *, char **);
int tgetflag(const char *);
int tgetnum(const char *);
char *tgoto(const char *, int, int);
void tputs(const char *, int, int (*)(int));
int tputs(const char *, int, int (*)(int));
/*
* New interface

View File

@ -1,4 +1,4 @@
/* $NetBSD: tputs.c,v 1.23 2005/05/15 21:11:13 christos Exp $ */
/* $NetBSD: tputs.c,v 1.24 2009/06/13 19:23:22 roy Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tputs.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: tputs.c,v 1.23 2005/05/15 21:11:13 christos Exp $");
__RCSID("$NetBSD: tputs.c,v 1.24 2009/06/13 19:23:22 roy Exp $");
#endif
#endif /* not lint */
@ -104,7 +104,7 @@ _tputs_convert(const char **ptr, int affcnt)
* The number of affected lines is affcnt, and the routine
* used to output one character is outc.
*/
void
int
tputs(const char *cp, int affcnt, int (*outc)(int))
{
int i = 0;
@ -113,7 +113,7 @@ tputs(const char *cp, int affcnt, int (*outc)(int))
_DIAGASSERT(outc != 0);
if (cp == 0)
return;
return -1;
/* scan and convert delay digits (if any) */
i = _tputs_convert(&cp, affcnt);
@ -129,9 +129,9 @@ tputs(const char *cp, int affcnt, int (*outc)(int))
* not comprehensible, then don't try to delay.
*/
if (i == 0)
return;
return 0;
if (ospeed <= 0 || ospeed >= TMSPC10SIZE)
return;
return 0;
/*
* Round up by a half a character frame,
@ -144,6 +144,7 @@ tputs(const char *cp, int affcnt, int (*outc)(int))
i += mspc10 / 2;
for (i /= mspc10; i > 0; i--)
(void)(*outc)(PC);
return 0;
}