From eb27e9933d46a2d10737f64dbd7d57cd6d80d8d0 Mon Sep 17 00:00:00 2001 From: agc Date: Mon, 5 Dec 2011 02:14:40 +0000 Subject: Avoid core-dumping with NetBSD/amd64 5.99.56 and later (i.e. gcc 4.5) Use c89 function defs Use correct header files --- devel/idiff/distinfo | 4 +-- devel/idiff/patches/patch-aa | 75 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 66 insertions(+), 13 deletions(-) (limited to 'devel') diff --git a/devel/idiff/distinfo b/devel/idiff/distinfo index cbad063bc3a..e72f08d60a7 100644 --- a/devel/idiff/distinfo +++ b/devel/idiff/distinfo @@ -1,7 +1,7 @@ -$NetBSD: distinfo,v 1.5 2005/02/23 22:24:16 agc Exp $ +$NetBSD: distinfo,v 1.6 2011/12/05 02:14:40 agc Exp $ SHA1 (idiff-1.0.tar.gz) = 4d3f339184745a45747385bca6f559665c6136f8 RMD160 (idiff-1.0.tar.gz) = 65012d4580d37c00274e8f1015cdf6b873cbc780 Size (idiff-1.0.tar.gz) = 2307 bytes -SHA1 (patch-aa) = c4ca9269a3a3d1432a33c6171af3c88cf541cf70 +SHA1 (patch-aa) = c56d6e04f393ebd4b68cd021fd2d7035c8f8f134 SHA1 (patch-ab) = 88d480c86527766cb602a57e9d1528da73675dbd diff --git a/devel/idiff/patches/patch-aa b/devel/idiff/patches/patch-aa index 6286bf23b1e..ae7e8d70e52 100644 --- a/devel/idiff/patches/patch-aa +++ b/devel/idiff/patches/patch-aa @@ -1,4 +1,4 @@ -$NetBSD: patch-aa,v 1.2 2001/05/29 08:16:05 agc Exp $ +$NetBSD: patch-aa,v 1.3 2011/12/05 02:14:40 agc Exp $ Don't overwrite read-only strings, so they can be placed in the text segment by a decent optimising compiler. @@ -6,17 +6,31 @@ segment by a decent optimising compiler. Honour the VISUAL and EDITOR settings in the environment before using ed(1) ---- idiff.c.orig Wed Sep 16 20:58:16 1998 -+++ idiff.c Tue May 29 09:11:44 2001 -@@ -1,5 +1,7 @@ +Use c89 function defs +Use correct header files + +--- idiff.c.orig 1998-09-16 12:58:16.000000000 -0700 ++++ idiff.c 2011-12-04 16:38:16.000000000 -0800 +@@ -1,16 +1,21 @@ /* idiff: interactive diff */ +-#include +#include + - #include #include ++#include ++#include ++#include ++#include char *progname; -@@ -11,6 +13,7 @@ +-#define HUGE 10000 /* large number of lines */ ++#define HUGE 100000 /* large number of lines */ + +-main(argc, argv) +- int argc; +- char *argv[]; ++int ++main(int argc, char **argv) { FILE *fin, *fout, *f1, *f2, *efopen(); char buf[BUFSIZ], *mktemp(); @@ -24,7 +38,7 @@ using ed(1) char *diffout = "idiff.XXXXXX"; progname = argv[0]; -@@ -21,6 +24,8 @@ +@@ -21,6 +26,8 @@ f1 = efopen(argv[1], "r"); f2 = efopen(argv[2], "r"); fout = efopen("idiff.out", "w"); @@ -33,9 +47,14 @@ using ed(1) mktemp(diffout); sprintf(buf,"diff %s %s >%s",argv[1],argv[2],diffout); system(buf); -@@ -34,11 +39,15 @@ - idiff(f1, f2, fin, fout) /* process diffs */ - FILE *f1, *f2, *fin, *fout; +@@ -31,14 +38,18 @@ + exit(0); + } + +-idiff(f1, f2, fin, fout) /* process diffs */ +- FILE *f1, *f2, *fin, *fout; ++void ++idiff(FILE *f1, FILE *f2, FILE *fin, FILE *fout) /* process diffs */ { + char realtempfile[MAXPATHLEN]; char *tempfile = "idiff.XXXXXX"; @@ -49,7 +68,7 @@ using ed(1) mktemp(tempfile); nf1 = nf2 = 0; while (fgets(buf, sizeof buf, fin) != NULL) { -@@ -76,7 +85,11 @@ +@@ -76,7 +87,11 @@ fprintf(ft, "---\n"); ncopy(f2, to2+1-from2, ft); fclose(ft); @@ -62,3 +81,37 @@ using ed(1) system(buf2); ft = efopen(tempfile, "r"); ncopy(ft, HUGE, fout); +@@ -98,9 +113,8 @@ + unlink(tempfile); + } + +-parse(s, pfrom1, pto1, pcmd, pfrom2, pto2) +- char *s; +- int *pcmd, *pfrom1, *pto1, *pfrom2, *pto2; ++void ++parse(char *s, int *pfrom1, int *pto1, int *pcmd, int *pfrom2, int *pto2) + { + #define a2i(p) while (isdigit(*s)) p = 10*(p) + *s++ - '0' + +@@ -120,8 +134,8 @@ + *pto2 = *pfrom2; + } + +-nskip(fin, n) /* skip n lines of file fin */ +- FILE *fin; ++void ++nskip(FILE *fin, int n) /* skip n lines of file fin */ + { + char buf[BUFSIZ]; + +@@ -129,8 +143,8 @@ + fgets(buf, sizeof buf, fin); + } + +-ncopy(fin, n, fout) /* copy n lines from fin to fout */ +- FILE *fin, *fout; ++void ++ncopy(FILE *fin, int n, FILE *fout) /* copy n lines from fin to fout */ + { + char buf[BUFSIZ]; + -- cgit v1.2.3