Fix a segfault on NetBSD/amd64 (at least):

- Include standard headers (stdlib.h, string.h, stdio.h) in misc.h to
   avoid conflicts with built-in declarations of functions.
 - Change CFLAGS= in Makefile to CFLAGS+= to use pkgsrc-provided CFLAGS.
 - Include termcap.buildlink3.mk to handle termcap properly.
 - Add DESTDIR support, use AUTO_MKDIRS.
 - Bump PKGREVISION.

 Now I can actually use it! ;)
This commit is contained in:
bjs 2008-07-09 05:02:06 +00:00
parent 9c19a98329
commit f5a6a01648
6 changed files with 130 additions and 38 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.5 2006/03/04 21:29:30 jlam Exp $
# $NetBSD: Makefile,v 1.6 2008/07/09 05:02:06 bjs Exp $
#
DISTNAME= spiff-1.0
PKGREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://www.darwinsys.com/freeware/
@ -9,6 +10,10 @@ MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.darwinsys.com/freeware/
COMMENT= Make controlled approximate comparisons between files
PKG_DESTDIR_SUPPORT= user-destdir
AUTO_MKDIRS= yes
BUILD_TARGET= spiff
.include "../../mk/termcap.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,11 +1,11 @@
$NetBSD: distinfo,v 1.5 2007/10/05 21:13:59 rillig Exp $
$NetBSD: distinfo,v 1.6 2008/07/09 05:02:06 bjs Exp $
SHA1 (spiff-1.0.tar.gz) = 09803fa6f946c3639bb2c7ac5b5644860ebed643
RMD160 (spiff-1.0.tar.gz) = ff651435946dd8889b9a01a598f3933e3e50c614
Size (spiff-1.0.tar.gz) = 48291 bytes
SHA1 (patch-aa) = 7385b723590f1e8ce86e830605da3ce1bd97a3ea
SHA1 (patch-ab) = 7d9bedb10742a36e2841d79ccd5d608b8eefeb5f
SHA1 (patch-aa) = c9ec15c551084c221bbe3d7729fb515ee65dd513
SHA1 (patch-ab) = 265a62ded94e73b42f8f46180613ff6e5de90399
SHA1 (patch-ac) = d88280626b3d1621377d38037a52e79e6e35bb1a
SHA1 (patch-ad) = 386f3130fdc97eb7e5472404aaf3f3bc8e94654c
SHA1 (patch-ae) = fb98434c7cead14541cd6b8a6bf36775ade76ed9
SHA1 (patch-ad) = 86d90bf42e1735f20fc8538522638f1b5af92d60
SHA1 (patch-ae) = a4d5f04fa69e775f3e39e60c93b764d0a6c0af7c
SHA1 (patch-af) = 5d922bcafe13e5f24347e78b9e1cd0859d295631

View file

@ -1,17 +1,17 @@
$NetBSD: patch-aa,v 1.1.1.1 2001/10/15 10:12:08 agc Exp $
$NetBSD: patch-aa,v 1.2 2008/07/09 05:02:06 bjs Exp $
--- Makefile 2001/10/15 09:58:02 1.1
+++ Makefile 2001/10/15 09:58:39
--- Makefile.orig 1994-05-01 18:51:17.000000000 -0400
+++ Makefile
@@ -7,7 +7,7 @@
# name of the directory into which the binary should be installed
# used only when you use 'make install'
#
-INSDIR=/usr/local/bin
+INSDIR=${PREFIX}
+INSDIR=${DESTDIR}${PREFIX}
#
# choose one from each of 1) 2) and 3) below
@@ -18,21 +18,21 @@
@@ -18,21 +18,21 @@ INSDIR=/usr/local/bin
# choose a) b) or c)
#
# a) for BSD derivitives, enable the following line
@ -37,7 +37,7 @@ $NetBSD: patch-aa,v 1.1.1.1 2001/10/15 10:12:08 agc Exp $
# b) if you are using terminfo on a XENIX machine, enable the following lines
#TFLAG=-DM_TERMINFO
@@ -44,8 +44,8 @@
@@ -44,8 +44,8 @@ OSFLAG=-DATT
#TLIB=curses
# d) NONE OF THE ABOVE
@ -48,3 +48,12 @@ $NetBSD: patch-aa,v 1.1.1.1 2001/10/15 10:12:08 agc Exp $
#
# 3) SELECTION OF WINDOW MANAGER AVAILABILITY
@@ -80,7 +80,7 @@ MANPAGE=spiff.1
# disable this line iff you like being honked at.
DEFS = -DNOCHATTER
-CFLAGS=-O $(OSFLAG) $(TFLAG) $(VISFLAG) $(DEFS)
+CFLAGS+=$(OSFLAG) $(TFLAG) $(VISFLAG) $(DEFS)
default: spiff

View file

@ -1,30 +1,29 @@
$NetBSD: patch-ab,v 1.3 2007/10/05 21:13:59 rillig Exp $
$NetBSD: patch-ab,v 1.4 2008/07/09 05:02:06 bjs Exp $
--- misc.h 2001/10/15 10:01:22 1.1
+++ misc.h 2001/10/15 10:02:19
@@ -8,6 +8,8 @@
--- misc.h.orig 1998-09-23 14:07:19.000000000 -0400
+++ misc.h
@@ -8,6 +8,11 @@
#ifndef Z_INCLUDED
+#include <sys/param.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
/*
** make sure that if we have a XENIX system, that
** we also treat it as an AT and T derivative
@@ -36,12 +38,16 @@
@@ -36,12 +41,6 @@ extern int *_Z_myalloc();
/*
** lines needed to shut up lint
*/
+#if defined(__STDC__)
+#include <string.h>
+#else
extern char *sprintf();
extern char *strcat();
extern char *strncat();
extern char *strcpy();
extern char *strncpy();
extern char *malloc();
+#endif
-extern char *sprintf();
-extern char *strcat();
-extern char *strncat();
-extern char *strcpy();
-extern char *strncpy();
-extern char *malloc();
extern void Z_complain();
extern void Z_fatal();

View file

@ -1,13 +1,51 @@
$NetBSD: patch-ad,v 1.1 2006/06/08 16:12:48 minskim Exp $
$NetBSD: patch-ad,v 1.2 2008/07/09 05:02:06 bjs Exp $
--- spiff.c.orig 1990-02-05 20:17:20.000000000 +0000
--- spiff.c.orig 1990-02-05 15:17:20.000000000 -0500
+++ spiff.c
@@ -27,7 +27,7 @@ static char rcsid[]= "$Header: spiff.c,v
@@ -27,7 +27,8 @@ static char rcsid[]= "$Header: spiff.c,v
#include "visual.h"
#include "output.h"
-extern void _Y_doargs();
+static void _Y_doargs();
+static void _Y_doargs(int argc, char *argv[], char **file1,
+ char **file2, int *max_d);
static int _Y_eflag = 0; /* use exact match algorithm */
static int _Y_vflag = 0; /* use visual mode */
@@ -38,9 +39,8 @@ static int _Y_vflag = 0; /* use visual m
*/
static int _Y_flags;
-main(argc,argv)
-int argc;
-char *argv[];
+int
+main(int argc, char *argv[])
{
E_edit edit_end;
char *filename[2];
@@ -120,9 +120,9 @@ char *argv[];
if (E_NULL != edit_end)
{
O_output(edit_end,_Y_flags);
- return(1);
+ return 1;
}
- return(0);
+ return 0;
}
/*
@@ -174,11 +174,7 @@ char *from;
#define SETPTR {if(strlen(argv[1]) == 2) {argv++;argc--;ptr=argv[1];}else ptr=(&argv[1][2]);}
static void
-_Y_doargs(argc,argv,file1,file2,max_d)
-int argc;
-char *argv[];
-char **file1,**file2;
-int *max_d;
+_Y_doargs(int argc, char *argv[], char **file1, char **file2, int *max_d)
{
char *ptr;

View file

@ -1,15 +1,56 @@
$NetBSD: patch-ae,v 1.1 2006/06/08 16:12:48 minskim Exp $
$NetBSD: patch-ae,v 1.2 2008/07/09 05:02:06 bjs Exp $
--- compare.c.orig 1990-02-05 20:17:15.000000000 +0000
--- compare.c.orig 1990-02-05 15:17:15.000000000 -0500
+++ compare.c
@@ -21,6 +21,10 @@ static char rcsid[]= "$Header: compare.c
@@ -17,12 +17,15 @@ static char rcsid[]= "$Header: compare.c
#include "token.h"
#include "line.h"
#include "float.h"
-#include "compare.h"
#include <ctype.h>
-X_com(a,b,flags)
-int a,b,flags;
+static int _X_cmptokens(K_token p1,K_token p2,int flags);
+static int _X_strcmp(char *s1, char *s2, int flags);
+static int _X_floatdiff(F_float p1, F_float p2, T_tol the_tol);
+static int _X_cmptokens(K_token p1, K_token p2, int flags);
+static int _X_floatdiff(F_float p1,F_float p2,T_tol the_tol);
+
X_com(a,b,flags)
int a,b,flags;
+int
+X_com(int a, int b, int flags)
{
K_token atmp,btmp;
@@ -47,9 +50,7 @@ int a,b,flags;
** same as strcmp() except that case can be optionally ignored
*/
static int
-_X_strcmp(s1,s2,flags)
-char *s1,*s2;
-int flags;
+_X_strcmp(char *s1, char *s2, int flags)
{
if (flags & U_NO_CASE)
{
@@ -84,9 +85,7 @@ int flags;
** routine to compare two tokens
*/
static int
-_X_cmptokens(p1,p2,flags)
-K_token p1, p2;
-int flags;
+_X_cmptokens(K_token p1,K_token p2,int flags)
{
if (K_gettype(p1) != K_gettype(p2))
{
@@ -114,9 +113,7 @@ int flags;
** compare two F_floats using a tolerance
*/
static int
-_X_floatdiff(p1,p2,the_tol)
-F_float p1,p2;
-T_tol the_tol;
+_X_floatdiff(F_float p1,F_float p2,T_tol the_tol)
{
F_float diff, float_tmp;
T_tol tol_tmp;