Subject: lib/1103: compile warnings in termcap library
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Thorsten Lockert <tholo@SigmaSoft.COM>
List: netbsd-bugs
Date: 06/03/1995 21:20:04
>Number:         1103
>Category:       lib
>Synopsis:       compile warnings in termcap library
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun  3 21:20:02 1995
>Originator:     Thorsten Lockert
>Organization:
SigmaSoft, Th. Lockert
>Release:        May 28, 1995
>Environment:
	
System: NetBSD gandalf.sigmasoft.com 1.0A NetBSD 1.0A (GANDALF) #1: Sun May 7 21:49:27 PDT 1995 tholo@gandalf.sigmasoft.com:/usr/src/sys/arch/i386/compile/GANDALF i386


>Description:
	There are multiple compile warnings in the termcap library when
	compiled with -Wall -Wstrict-prototypes.

	In addition, one of the prototypes in <curses.h> is wrong.

>How-To-Repeat:
	Compile termcap library with -Wall -Wstrict-prototypes

>Fix:
	Apply the following patches:

*** src/lib/libcurses/curses.h.orig	Sat Jun  3 21:01:40 1995
--- src/lib/libcurses/curses.h	Sat Jun  3 21:01:51 1995
***************
*** 335,341 ****
  int	 tgetflag __P((char *));
  char	*tgetstr __P((char *, char **));
  char	*tgoto __P((char *, int, int));
! int	 tputs __P((char *, int, void (*)(int)));
  __END_DECLS
  
  #endif /* !_CURSES_H_ */
--- 335,341 ----
  int	 tgetflag __P((char *));
  char	*tgetstr __P((char *, char **));
  char	*tgoto __P((char *, int, int));
! void	 tputs __P((char *, int, void (*)(int)));
  __END_DECLS
  
  #endif /* !_CURSES_H_ */
Common subdirectories: src/lib/libterm.orig/TEST and src/lib/libterm/TEST
diff -c src/lib/libterm.orig/termcap.c src/lib/libterm/termcap.c
*** src/lib/libterm.orig/termcap.c	Sat Jun  3 20:53:27 1995
--- src/lib/libterm/termcap.c	Sat Jun  3 20:57:44 1995
***************
*** 48,53 ****
--- 48,54 ----
  #include <ctype.h>
  #include <stdlib.h>
  #include <string.h>
+ #include <curses.h>
  #include "pathnames.h"
  
  /*
***************
*** 100,111 ****
  	 * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
  	 */
  	if (!cp || *cp != '/') {	/* no TERMCAP or it holds an entry */
! 		if (termpath = getenv("TERMPATH"))
  			strncpy(pathbuf, termpath, PBUFSIZ);
  		else {
! 			if (home = getenv("HOME")) {	/* set up default */
! 				p += strlen(home);	/* path, looking in */
! 				strcpy(pathbuf, home);	/* $HOME first */
  				*p++ = '/';
  			}	/* if no $HOME look in current directory */
  			strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));
--- 101,112 ----
  	 * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
  	 */
  	if (!cp || *cp != '/') {	/* no TERMCAP or it holds an entry */
! 		if ((termpath = getenv("TERMPATH")) != NULL)
  			strncpy(pathbuf, termpath, PBUFSIZ);
  		else {
! 			if ((home = getenv("HOME")) != NULL) {	/* set up default */
! 				p += strlen(home);		/* path, looking in */
! 				strcpy(pathbuf, home);		/* $HOME first */
  				*p++ = '/';
  			}	/* if no $HOME look in current directory */
  			strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));
diff -c src/lib/libterm.orig/tgoto.c src/lib/libterm/tgoto.c
*** src/lib/libterm.orig/tgoto.c	Sat Jun  3 20:53:27 1995
--- src/lib/libterm/tgoto.c	Sat Jun  3 20:56:25 1995
***************
*** 42,47 ****
--- 42,48 ----
  #endif /* not lint */
  
  #include <string.h>
+ #include <curses.h>
  
  #define	CTRL(c)	((c) & 037)
  
***************
*** 95,101 ****
  		return ("OOPS");
  	}
  	added[0] = 0;
! 	while (c = *cp++) {
  		if (c != '%') {
  			*dp++ = c;
  			continue;
--- 96,102 ----
  		return ("OOPS");
  	}
  	added[0] = 0;
! 	while ((c = *cp++) != '\0') {
  		if (c != '%') {
  			*dp++ = c;
  			continue;
***************
*** 146,152 ****
  			/* fall into... */
  
  		case '.':
- casedot:
  			/*
  			 * This code is worth scratching your head at for a
  			 * while.  The idea is that various weird things can
--- 147,152 ----
diff -c src/lib/libterm.orig/tputs.c src/lib/libterm/tputs.c
*** src/lib/libterm.orig/tputs.c	Sat Jun  3 20:53:28 1995
--- src/lib/libterm/tputs.c	Sat Jun  3 20:59:07 1995
***************
*** 43,48 ****
--- 43,51 ----
  
  #include <sgtty.h>
  #include <ctype.h>
+ #include <curses.h>
+ 
+ #undef ospeed
  
  /*
   * The following array gives the number of tens of milliseconds per
***************
*** 62,71 ****
   * The number of affected lines is affcnt, and the routine
   * used to output one character is outc.
   */
  tputs(cp, affcnt, outc)
  	register char *cp;
  	int affcnt;
! 	int (*outc)();
  {
  	register int i = 0;
  	register int mspc10;
--- 65,75 ----
   * The number of affected lines is affcnt, and the routine
   * used to output one character is outc.
   */
+ void
  tputs(cp, affcnt, outc)
  	register char *cp;
  	int affcnt;
! 	void (*outc) __P((int));
  {
  	register int i = 0;
  	register int mspc10;
>Audit-Trail:
>Unformatted: