Subject: lib/1526: libterm is not self-contained; it needs a termcap.h
To: None <gnats-bugs@gnats.netbsd.org>
From: Mike Long <mike.long@analog.com>
List: netbsd-bugs
Date: 09/26/1995 23:34:56
>Number:         1526
>Category:       lib
>Synopsis:       libterm is not self-contained; it needs a termcap.h
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 26 23:50:01 1995
>Last-Modified:
>Originator:     Mike Long <mike.long@analog.com>
>Organization:
	HaHaHoHo
>Release:        950926
>Environment:
System: NetBSD azathoth 1.0A NetBSD 1.0A (AZATHOTH) #1: Fri Sep 22 22:45:08 EDT 1995 root@azathoth:/usr/src/sys/arch/i386/compile/AZATHOTH i386

>Description:
	libterm needs a header file (curses.h) from libcurses in order
to build properly, but that header is not installed before libterm is
built when using the "standard" build process.

>How-To-Repeat:
	rm -f /usr/include/curses.h
	cd /usr/src/lib
	make

(reinstalling the 1.0 version of curses.h or setting DESTDIR to
something other than / will also probably work)

>Fix:
	(I know that BSD libcurses and libterm will eventually Go Away
in favor of ncurses, but this fix should make a good stopgap measure
until that happens.  All header names, etc., are consistent with the
way ncurses does things.)

	I copied the termcap-related definitions from
libcurses/curses.h to libterm/termcap.h, updated the Makefile, and
updated the libterm sources to use <termcap.h> instead of <curses.h>.

	I decided that ripping all of the termcap-related things out
of curses.h would be premature, so I left libcurses alone.

*** /dev/null   Tue Sep 26 22:14:45 1995
--- /usr/src/lib/libterm/termcap.h      Thu Sep 14 02:45:40 1995
***************
*** 0 ****
--- 1,60 ----
+ /*    $NetBSD$        */
+ 
+ /*
+  * Copyright (c) 1981, 1993, 1994
+  *    The Regents of the University of California.  All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *    This product includes software developed by the University of
+  *    California, Berkeley and its contributors.
+  * 4. Neither the name of the University nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  *
+  *    @(#)curses.h    8.4 (Berkeley) 8/10/94
+  */
+ 
+ #ifndef _TERMCAP_H_
+ #define       _TERMCAP_H_
+ 
+ #include <sys/types.h>
+ #include <sys/cdefs.h>
+ 
+ /* Termcap capabilities. */
+ extern char   PC;
+ extern char   *BC, *UP;
+ 
+ extern short  ospeed;
+ 
+ /* Termcap functions. */
+ __BEGIN_DECLS
+ int    tgetent __P((char *, char *));
+ int    tgetnum __P((char *));
+ 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 /* !_TERMCAP_H_ */

*** /usr/src/lib/libterm/Makefile.orig  Wed Mar  1 22:21:28 1995
--- /usr/src/lib/libterm/Makefile       Thu Sep 14 02:59:50 1995
***************
*** 3,7 ****
  
  LIB=  termcap
! CFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D
  SRCS= termcap.c tgoto.c tputs.c
  
--- 3,7 ----
  
  LIB=  termcap
! CFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D -I${.CURDIR}
  SRCS= termcap.c tgoto.c tputs.c
  
***************
*** 10,13 ****
--- 10,19 ----
        termcap.3 tgetstr.3 termcap.3 tgoto.3 termcap.3 tputs.3
  LINKS=        ${LIBDIR}/libtermcap.a ${LIBDIR}/libtermlib.a
+ 
+ beforeinstall:
+       -cd ${.CURDIR}; cmp -s termcap.h ${DESTDIR}/usr/include/termcap.h > \
+           /dev/null 2>&1 || \
+           install -c -o ${BINOWN} -g ${BINGRP} -m 444 termcap.h \
+           ${DESTDIR}/usr/include
  
  .include <bsd.lib.mk>

*** /usr/src/lib/libterm/termcap.c.orig Thu Jun  8 05:56:01 1995
--- /usr/src/lib/libterm/termcap.c      Thu Sep 14 02:51:52 1995
***************
*** 49,53 ****
  #include <stdlib.h>
  #include <string.h>
! #include <curses.h>
  #include "pathnames.h"
  
--- 49,53 ----
  #include <stdlib.h>
  #include <string.h>
! #include <termcap.h>
  #include "pathnames.h"
  

*** /usr/src/lib/libterm/tgoto.c.orig   Thu Jun  8 05:56:01 1995
--- /usr/src/lib/libterm/tgoto.c        Thu Sep 14 02:52:50 1995
***************
*** 43,47 ****
  
  #include <string.h>
! #include <curses.h>
  
  #define       CTRL(c) ((c) & 037)
--- 43,47 ----
  
  #include <string.h>
! #include <termcap.h>
  
  #define       CTRL(c) ((c) & 037)

*** /usr/src/lib/libterm/tputs.c.orig   Thu Jun  8 05:56:01 1995
--- /usr/src/lib/libterm/tputs.c        Thu Sep 14 02:49:29 1995
***************
*** 42,49 ****
  #endif /* not lint */
  
- #include <sgtty.h>
  #include <ctype.h>
! #include <curses.h>
! #undef ospeed
  
  /*
--- 42,47 ----
  #endif /* not lint */
  
  #include <ctype.h>
! #include <termcap.h>
  
  /*

>Audit-Trail:
>Unformatted: