--- etc/papd/printcap.c.orig	Sun Aug 17 09:20:28 1997
+++ etc/papd/printcap.c	Fri Oct 29 12:56:24 1999
@@ -40,9 +40,15 @@
 static char sccsid[] = "@(#)printcap.c	5.7 (Berkeley) 3/4/91";
 #endif /* not lint */
 
+#include <sys/types.h>
+#include <sys/uio.h>
 #include <ctype.h>
+#include <curses.h>
+#include <fcntl.h>
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
+#include <term.h>
+#include <unistd.h>
 #include <atalk/paths.h>
 
 #ifndef BUFSIZ
@@ -66,7 +72,6 @@
 
 #define PRINTCAP
 
-#ifdef PRINTCAP
 #define tgetent	pgetent
 #define tskip	pskip
 #define tgetstr	pgetstr
@@ -77,7 +82,8 @@
 #define tnchktc	pnchktc
 #define	tnamatch pnamatch
 #define V6
-#endif
+
+int	pnchktc(), pnamatch();
 
 static	FILE *pfp = NULL;	/* printcap data base file pointer */
 static	char *tbuf;
@@ -94,6 +100,7 @@
  * Added a "cap" parameter, so we can use these calls for printcap
  * and papd.conf.
  */
+int
 getprent( cap, bp)
 	register char *cap;
 	register char *bp;
@@ -136,6 +143,7 @@
 	}
 }
 
+void
 endprent()
 {
 	if (pfp != NULL)
@@ -150,6 +158,7 @@
  * Added a "cap" parameter, so we can use these calls for printcap
  * and papd.conf.
  */
+int
 tgetent( cap, bp, name)
 	char *cap, *bp, *name;
 {
@@ -157,7 +166,6 @@
 	register int c;
 	register int i = 0, cnt = 0;
 	char ibuf[BUFSIZ];
-	char *cp2;
 	int tf;
 
 	hopcount = 0;
@@ -176,7 +184,7 @@
 		if (*cp!='/') {
 			cp2 = getenv("TERM");
 			if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
-				strcpy(bp,cp);
+				(void)strlcpy(bp,cp, sizeof( bp ) );
 				return(tnchktc());
 			} else {
 				tf = open(cap, 0);
@@ -238,6 +246,7 @@
  * Added a "cap" parameter, so we can use these calls for printcap
  * and papd.conf.
  */
+int
 tnchktc( cap )
     char *cap;
 {
@@ -257,7 +266,7 @@
 	/* p now points to beginning of last field */
 	if (p[0] != 't' || p[1] != 'c')
 		return(1);
-	strcpy(tcname,p+3);
+	(void)strlcpy(tcname,p+3, sizeof ( tcname ) );
 	q = tcname;
 	while (q && *q != ':')
 		q++;
@@ -275,7 +284,7 @@
 		write(2, "Termcap entry too long\n", 23);
 		q[BUFSIZ - (p-tbuf)] = 0;
 	}
-	strcpy(p, q+1);
+	(void)strlcpy(p, q+1, sizeof( p ) );
 	tbuf = holdtbuf;
 	return(1);
 }
@@ -286,6 +295,7 @@
  * against each such name.  The normal : terminator after the last
  * name (before the first field) stops us.
  */
+int
 tnamatch(np)
 	char *np;
 {
@@ -332,6 +342,7 @@
  * a # character.  If the option is not found we return -1.
  * Note that we handle octal numbers beginning with 0.
  */
+int
 tgetnum(id)
 	char *id;
 {
@@ -365,6 +376,7 @@
  * of the buffer.  Return 1 if we find the option, or 0 if it is
  * not given.
  */
+int
 tgetflag(id)
 	char *id;
 {
