Mon Dec 5 02:14:40 2011 UTC ()
Avoid core-dumping with NetBSD/amd64 5.99.56 and later (i.e. gcc 4.5)

Use c89 function defs
Use correct header files


(agc)
diff -r1.5 -r1.6 pkgsrc/devel/idiff/distinfo
diff -r1.2 -r1.3 pkgsrc/devel/idiff/patches/patch-aa

cvs diff -r1.5 -r1.6 pkgsrc/devel/idiff/distinfo (expand / switch to unified diff)

--- pkgsrc/devel/idiff/distinfo 2005/02/23 22:24:16 1.5
+++ pkgsrc/devel/idiff/distinfo 2011/12/05 02:14:40 1.6
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
1$NetBSD: distinfo,v 1.5 2005/02/23 22:24:16 agc Exp $ 1$NetBSD: distinfo,v 1.6 2011/12/05 02:14:40 agc Exp $
2 2
3SHA1 (idiff-1.0.tar.gz) = 4d3f339184745a45747385bca6f559665c6136f8 3SHA1 (idiff-1.0.tar.gz) = 4d3f339184745a45747385bca6f559665c6136f8
4RMD160 (idiff-1.0.tar.gz) = 65012d4580d37c00274e8f1015cdf6b873cbc780 4RMD160 (idiff-1.0.tar.gz) = 65012d4580d37c00274e8f1015cdf6b873cbc780
5Size (idiff-1.0.tar.gz) = 2307 bytes 5Size (idiff-1.0.tar.gz) = 2307 bytes
6SHA1 (patch-aa) = c4ca9269a3a3d1432a33c6171af3c88cf541cf70 6SHA1 (patch-aa) = c56d6e04f393ebd4b68cd021fd2d7035c8f8f134
7SHA1 (patch-ab) = 88d480c86527766cb602a57e9d1528da73675dbd 7SHA1 (patch-ab) = 88d480c86527766cb602a57e9d1528da73675dbd

cvs diff -r1.2 -r1.3 pkgsrc/devel/idiff/patches/patch-aa (expand / switch to unified diff)

--- pkgsrc/devel/idiff/patches/patch-aa 2001/05/29 08:16:05 1.2
+++ pkgsrc/devel/idiff/patches/patch-aa 2011/12/05 02:14:40 1.3
@@ -1,64 +1,117 @@ @@ -1,64 +1,117 @@
1$NetBSD: patch-aa,v 1.2 2001/05/29 08:16:05 agc Exp $ 1$NetBSD: patch-aa,v 1.3 2011/12/05 02:14:40 agc Exp $
2 2
3Don't overwrite read-only strings, so they can be placed in the text 3Don't overwrite read-only strings, so they can be placed in the text
4segment by a decent optimising compiler. 4segment by a decent optimising compiler.
5 5
6Honour the VISUAL and EDITOR settings in the environment before 6Honour the VISUAL and EDITOR settings in the environment before
7using ed(1) 7using ed(1)
8 8
9--- idiff.c.orig Wed Sep 16 20:58:16 1998 9Use c89 function defs
10+++ idiff.c Tue May 29 09:11:44 2001 10Use correct header files
11@@ -1,5 +1,7 @@ 11
 12--- idiff.c.orig 1998-09-16 12:58:16.000000000 -0700
 13+++ idiff.c 2011-12-04 16:38:16.000000000 -0800
 14@@ -1,16 +1,21 @@
12 /* idiff: interactive diff */ 15 /* idiff: interactive diff */
13  16
 17-#include <stdio.h>
14+#include <sys/param.h> 18+#include <sys/param.h>
15+ 19+
16 #include <stdio.h> 
17 #include <ctype.h> 20 #include <ctype.h>
 21+#include <stdio.h>
 22+#include <stdlib.h>
 23+#include <string.h>
 24+#include <unistd.h>
18 char *progname; 25 char *progname;
19@@ -11,6 +13,7 @@ 26-#define HUGE 10000 /* large number of lines */
 27+#define HUGE 100000 /* large number of lines */
 28
 29-main(argc, argv)
 30- int argc;
 31- char *argv[];
 32+int
 33+main(int argc, char **argv)
20 { 34 {
21 FILE *fin, *fout, *f1, *f2, *efopen(); 35 FILE *fin, *fout, *f1, *f2, *efopen();
22 char buf[BUFSIZ], *mktemp(); 36 char buf[BUFSIZ], *mktemp();
23+ char realdiffname[MAXPATHLEN]; 37+ char realdiffname[MAXPATHLEN];
24 char *diffout = "idiff.XXXXXX"; 38 char *diffout = "idiff.XXXXXX";
25  39
26 progname = argv[0]; 40 progname = argv[0];
27@@ -21,6 +24,8 @@ 41@@ -21,6 +26,8 @@
28 f1 = efopen(argv[1], "r"); 42 f1 = efopen(argv[1], "r");
29 f2 = efopen(argv[2], "r"); 43 f2 = efopen(argv[2], "r");
30 fout = efopen("idiff.out", "w"); 44 fout = efopen("idiff.out", "w");
31+ (void) strcpy(realdiffname, diffout); 45+ (void) strcpy(realdiffname, diffout);
32+ diffout = realdiffname; 46+ diffout = realdiffname;
33 mktemp(diffout); 47 mktemp(diffout);
34 sprintf(buf,"diff %s %s >%s",argv[1],argv[2],diffout); 48 sprintf(buf,"diff %s %s >%s",argv[1],argv[2],diffout);
35 system(buf); 49 system(buf);
36@@ -34,11 +39,15 @@ 50@@ -31,14 +38,18 @@
37 idiff(f1, f2, fin, fout) /* process diffs */ 51 exit(0);
38 FILE *f1, *f2, *fin, *fout; 52 }
 53
 54-idiff(f1, f2, fin, fout) /* process diffs */
 55- FILE *f1, *f2, *fin, *fout;
 56+void
 57+idiff(FILE *f1, FILE *f2, FILE *fin, FILE *fout) /* process diffs */
39 { 58 {
40+ char realtempfile[MAXPATHLEN]; 59+ char realtempfile[MAXPATHLEN];
41 char *tempfile = "idiff.XXXXXX"; 60 char *tempfile = "idiff.XXXXXX";
42 char buf[BUFSIZ], buf2[BUFSIZ], *mktemp(); 61 char buf[BUFSIZ], buf2[BUFSIZ], *mktemp();
43 FILE *ft, *efopen(); 62 FILE *ft, *efopen();
44 int cmd, n, from1, to1, from2, to2, nf1, nf2; 63 int cmd, n, from1, to1, from2, to2, nf1, nf2;
45+ char *ed; 64+ char *ed;
46  65
47+ (void) strcpy(realtempfile, tempfile); 66+ (void) strcpy(realtempfile, tempfile);
48+ tempfile = realtempfile; 67+ tempfile = realtempfile;
49 mktemp(tempfile); 68 mktemp(tempfile);
50 nf1 = nf2 = 0; 69 nf1 = nf2 = 0;
51 while (fgets(buf, sizeof buf, fin) != NULL) { 70 while (fgets(buf, sizeof buf, fin) != NULL) {
52@@ -76,7 +85,11 @@ 71@@ -76,7 +87,11 @@
53 fprintf(ft, "---\n"); 72 fprintf(ft, "---\n");
54 ncopy(f2, to2+1-from2, ft); 73 ncopy(f2, to2+1-from2, ft);
55 fclose(ft); 74 fclose(ft);
56- sprintf(buf2, "ed %s", tempfile);  75- sprintf(buf2, "ed %s", tempfile);
57+ if ((ed = getenv("VISUAL")) == NULL && 76+ if ((ed = getenv("VISUAL")) == NULL &&
58+ (ed = getenv("EDITOR")) == NULL) { 77+ (ed = getenv("EDITOR")) == NULL) {
59+ ed = "/bin/ed"; 78+ ed = "/bin/ed";
60+ } 79+ }
61+ snprintf(buf2, sizeof(buf2), "%s %s", ed, tempfile);  80+ snprintf(buf2, sizeof(buf2), "%s %s", ed, tempfile);
62 system(buf2); 81 system(buf2);
63 ft = efopen(tempfile, "r"); 82 ft = efopen(tempfile, "r");
64 ncopy(ft, HUGE, fout); 83 ncopy(ft, HUGE, fout);
 84@@ -98,9 +113,8 @@
 85 unlink(tempfile);
 86 }
 87
 88-parse(s, pfrom1, pto1, pcmd, pfrom2, pto2)
 89- char *s;
 90- int *pcmd, *pfrom1, *pto1, *pfrom2, *pto2;
 91+void
 92+parse(char *s, int *pfrom1, int *pto1, int *pcmd, int *pfrom2, int *pto2)
 93 {
 94 #define a2i(p) while (isdigit(*s)) p = 10*(p) + *s++ - '0'
 95
 96@@ -120,8 +134,8 @@
 97 *pto2 = *pfrom2;
 98 }
 99
 100-nskip(fin, n) /* skip n lines of file fin */
 101- FILE *fin;
 102+void
 103+nskip(FILE *fin, int n) /* skip n lines of file fin */
 104 {
 105 char buf[BUFSIZ];
 106
 107@@ -129,8 +143,8 @@
 108 fgets(buf, sizeof buf, fin);
 109 }
 110
 111-ncopy(fin, n, fout) /* copy n lines from fin to fout */
 112- FILE *fin, *fout;
 113+void
 114+ncopy(FILE *fin, int n, FILE *fout) /* copy n lines from fin to fout */
 115 {
 116 char buf[BUFSIZ];
 117