1.0->1.1, more stuff moved into github repo, uses GH_TAG like a good kid. Man page converted to mandoc.
Index: Makefile =================================================================== RCS file: /cvs/ports/textproc/idiff/Makefile,v retrieving revision 1.20 diff -u -p -r1.20 Makefile --- Makefile 11 Mar 2013 11:42:42 -0000 1.20 +++ Makefile 12 May 2019 19:27:39 -0000 @@ -1,12 +1,13 @@ -# $OpenBSD: Makefile,v 1.20 2013/03/11 11:42:42 espie Exp $ +# $OpenBSD: Makefile,v 1.19 2013/01/09 23:24:09 sthen Exp $ # -COMMENT= powerful command-line front end to diff +COMMENT= command-line front end to diff -DISTNAME= idiff-1.0 -REVISION= 1 -CATEGORIES= textproc -MASTER_SITES= http://www.darwinsys.com/freeware/ +GH_ACCOUNT = iandarwin +GH_PROJECT = idiff +GH_TAGNAME = v1.1 + +CATEGORIES = textproc MAINTAINER= Ian Darwin <i...@openbsd.org> Index: distinfo =================================================================== RCS file: /cvs/ports/textproc/idiff/distinfo,v retrieving revision 1.4 diff -u -p -r1.4 distinfo --- distinfo 9 Jan 2013 23:24:09 -0000 1.4 +++ distinfo 12 May 2019 19:27:39 -0000 @@ -1,2 +1,2 @@ -SHA256 (idiff-1.0.tar.gz) = HXO7jDLxWOph1vvjwUV2ZKMWw0/bYKLnyCjUIB/GEEs= -SIZE (idiff-1.0.tar.gz) = 2307 +SHA256 (idiff-1.1.tar.gz) = 7QY/lDPOM3HW2dfocs9wEk6dO+LHR5c3Ute7XhKqyMg= +SIZE (idiff-1.1.tar.gz) = 4311 Index: patches/patch-idiff_1 =================================================================== RCS file: patches/patch-idiff_1 diff -N patches/patch-idiff_1 --- patches/patch-idiff_1 8 Jul 2011 09:52:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,83 +0,0 @@ -$OpenBSD: patch-idiff_1,v 1.1 2011/07/08 09:52:50 jasper Exp $ ---- idiff.1.orig Fri Jul 8 11:46:48 2011 -+++ idiff.1 Fri Jul 8 11:46:48 2011 -@@ -0,0 +1,79 @@ -+.TH IDIFF Local -+.SH NAME -+idiff \- interactive diff of two files -+.SH SYNOPSIS -+.B idiff -+file1 file2 -+.SH DESCRIPTION -+.I Idiff -+runs -+.IR diff (1) -+on the specified files and then -+presents each chunk of -+.I diff -+output and offers the user the option of -+choosing the ``from'' part or the ``to'' part, -+or editing the parts. -+.I Idiff -+produces the selected pieces in the proper order in a file called -+.IR idiff.out . -+.LP -+After each chunk is presented, -+.I idiff -+will prompt the user (with a `? ') -+for a command. -+The valid commands are: -+.TP -+.B < -+Take the ``from'' portion of the displayed chunk. -+This is the portion which -+was extracted from the first file specified. -+.TP -+.B > -+Take the ``to'' portion of the displayed chunk. -+This corresponds to that -+extracted from the second file specified. -+.TP -+.B e -+Invoke an editor on the chunk. -+The contents of shell variable EDITOR select the editor to be used. -+The default is -+.IR /bin/ed . -+Whatever is written out from -+.I ed -+will be placed into the final output. -+.TP -+.B q< -+Take all the rest of the '<' choices automatically. -+Think of this as ``quit from''. -+.TP -+.B q> -+Take all the rest of the '>' choices automatically. -+Think of this as ``quit to''. -+.TP -+.B ! -+Pass the command buffer to the shell for processing. -+.LP -+All code that -+.I diff -+considers identical in both input files -+is automatically put into the output file. -+.SH FILES -+.I idiff.out -+\- merged output -+.SH BUGS -+It is not possible to pass any options to -+.I diff -+through -+.I idiff. -+Nor can you use `-' as a filename argument. -+.SH HISTORY -+.I Idiff -+appears in the book -+.I ``The UNIX Programming Environment'' -+by Brian Kernighan and Rob Pike. -+.SH SEE ALSO -+.I sdiff (1) -+(side-by-side diff), a GNU tool that is included in OpenBSD. -+.I mgdiff (1), -+an X11 tool for comparing two files visually. Index: patches/patch-idiff_c =================================================================== RCS file: patches/patch-idiff_c diff -N patches/patch-idiff_c --- patches/patch-idiff_c 8 Jul 2011 09:52:50 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,280 +0,0 @@ -$OpenBSD: patch-idiff_c,v 1.1 2011/07/08 09:52:50 jasper Exp $ ---- idiff.c.orig Wed Sep 16 21:58:16 1998 -+++ idiff.c Fri Jul 8 11:46:48 2011 -@@ -1,45 +1,109 @@ - /* idiff: interactive diff */ - - #include <stdio.h> -+#include <stdlib.h> -+#include <unistd.h> -+#include <string.h> - #include <ctype.h> --char *progname; --#define HUGE 10000 /* large number of lines */ -+#include <signal.h> -+#include <assert.h> -+#include <sys/stat.h> -+#include <err.h> - --main(argc, argv) -- int argc; -- char *argv[]; -+#define HUGE 1000000L -+ -+char *progname; /* for error messages */ -+char *DIFFOUT = "/tmp/idiff.XXXXXXXX"; -+char *TEMPFILE = "/tmp/idiff.XXXXXXXX"; -+char *diffout, *tempfile; -+ -+FILE *efopen(const char *fname, const char *fmode); -+void onintr(const int signum); -+void idiff(FILE *f1, FILE *f2, FILE *fin, FILE *fout); -+void parse(char *s, int* pfrom1, int* pto1, int* pcmd, int* pfrom2, int* pto2); -+void nskip(FILE *fin, int n); -+void ncopy(FILE *fin, int n, FILE *fout); -+ -+int -+main(int argc, char *argv[]) - { -- FILE *fin, *fout, *f1, *f2, *efopen(); -- char buf[BUFSIZ], *mktemp(); -- char *diffout = "idiff.XXXXXX"; -+ FILE *fin, *fout, *f1, *f2; -+ char cmdBuf[1024], *inname1, *inname2; -+ int c, errflg = 0; -+ extern int optind; -+ extern char *optarg; -+ int use_b = 0; /* true --> use diff -b */ -+ struct stat sbuf; - - progname = argv[0]; -- if (argc != 3) { -- fprintf(stderr, "Usage: idiff file1 file2\n"); -+ -+ while ((c = getopt(argc, argv, "b")) != EOF) -+ switch (c) { -+ case 'b': -+ use_b = 1; -+ break; -+ case '?': -+ default: -+ errflg++; -+ break; -+ } -+ if (errflg) { -+ (void) fprintf(stderr, "usage: %s xxx [file] ...\n", progname); -+ exit(2); -+ } -+ if (argc-optind != 2) { -+ fprintf(stderr, "usage: idiff file1 file2\n"); - exit(1); - } -- f1 = efopen(argv[1], "r"); -- f2 = efopen(argv[2], "r"); -+ if (signal(SIGINT, SIG_IGN) != SIG_IGN) -+ (void) signal(SIGINT, onintr); -+ inname1 = argv[optind+0]; -+ inname2 = argv[optind+1]; -+ f1 = efopen(inname1, "r"); -+ if (stat(inname2, &sbuf) == -1) { -+ err(1, "Can't open %s", inname2); -+ } -+ /* If arg2 is a directory, do what diff would do, but we do it -+ * because we need to read the file back in, in bitsies, later on. -+ */ -+ if (S_ISDIR(sbuf.st_mode)) { -+ char*tmp = (char*)malloc(strlen(inname2)+1+strlen(inname1)); -+ sprintf(tmp, "%s/%s", inname2, inname1); -+ inname2 = tmp; -+ } -+ f2 = efopen(inname2, "r"); - fout = efopen("idiff.out", "w"); -- mktemp(diffout); -- sprintf(buf,"diff %s %s >%s",argv[1],argv[2],diffout); -- system(buf); -+ if ((diffout = mktemp(strdup(DIFFOUT))) == NULL) -+ err(1, "Can't mktemp(%s)", diffout); -+ (void) sprintf(cmdBuf, "diff %s %s %s >%s", -+ use_b ? "-b" : "", -+ inname1, inname2, diffout); -+ (void) system(cmdBuf); - fin = efopen(diffout, "r"); - idiff(f1, f2, fin, fout); -- unlink(diffout); -+ (void) unlink(diffout); - printf("%s output in file idiff.out\n", progname); - exit(0); - } - --idiff(f1, f2, fin, fout) /* process diffs */ -- FILE *f1, *f2, *fin, *fout; -+/* process diffs */ -+void -+idiff(FILE *f1, FILE *f2, FILE *fin, FILE *fout) - { -- char *tempfile = "idiff.XXXXXX"; -- char buf[BUFSIZ], buf2[BUFSIZ], *mktemp(); -- FILE *ft, *efopen(); -+ char buf[BUFSIZ], buf2[BUFSIZ], *ed, *getenv(); -+ FILE *ft; - int cmd, n, from1, to1, from2, to2, nf1, nf2; - -- mktemp(tempfile); -+ assert(f1 != NULL); -+ assert(f2 != NULL); -+ assert(fin != NULL); -+ assert(fout != NULL); -+ -+ if ((tempfile = mktemp(strdup(TEMPFILE))) == NULL) -+ err(1, "Can't mktemp(%s)", tempfile); -+ if ((ed=getenv("EDITOR")) == NULL) -+ ed = "/bin/ed"; -+ - nf1 = nf2 = 0; - while (fgets(buf, sizeof buf, fin) != NULL) { - parse(buf, &from1, &to1, &cmd, &from2, &to2); -@@ -52,13 +116,13 @@ idiff(f1, f2, fin, fout) /* process diffs */ - from2++; - printf("%s", buf); - while (n-- > 0) { -- fgets(buf, sizeof buf, fin); -+ (void) fgets(buf, sizeof buf, fin); - printf("%s", buf); - } - do { - printf("? "); -- fflush(stdout); -- fgets(buf, sizeof buf, stdin); -+ (void) fflush(stdout); -+ (void) fgets(buf, sizeof buf, stdin); - switch (buf[0]) { - case '>': - nskip(f1, to1-nf1); -@@ -75,34 +139,57 @@ idiff(f1, f2, fin, fout) /* process diffs */ - ncopy(f1, to1+1-from1, ft); - fprintf(ft, "---\n"); - ncopy(f2, to2+1-from2, ft); -- fclose(ft); -- sprintf(buf2, "ed %s", tempfile); -- system(buf2); -+ (void) fclose(ft); -+ (void) sprintf(buf2, "%s %s", ed, tempfile); -+ (void) system(buf2); - ft = efopen(tempfile, "r"); - ncopy(ft, HUGE, fout); -- fclose(ft); -+ (void) fclose(ft); - break; - case '!': -- system(buf+1); -+ (void) system(buf+1); - printf("!\n"); - break; -+ case 'q': -+ switch (buf[1]) { -+ case '>' : -+ nskip(f1, HUGE); -+ ncopy(f2, HUGE, fout); -+ /* this can fail on immense files */ -+ goto out; -+ break; -+ case '<' : -+ nskip(f2, HUGE); -+ ncopy(f1, HUGE, fout); -+ /* this can fail on immense files */ -+ goto out; -+ break; -+ default: -+ fprintf(stderr, -+ "%s: q must be followed by a < or a >!\n", progname); -+ break; -+ } -+ break; - default: -- printf("< or > or e or !\n"); -+ fprintf(stderr, -+ "%s: >, q>, <, q<, ! or e only!\n", -+ progname); - break; - } -- } while (buf[0]!='<' && buf[0]!='>' && buf[0]!='e'); -+ } while (buf[0] != '<' && buf[0] != '>' -+ && buf[0] != 'q' && buf[0] != 'e'); - nf1 = to1; - nf2 = to2; - } -- ncopy(f1, HUGE, fout); /* can fail on very long files */ -- unlink(tempfile); -+out: -+ ncopy(f1, HUGE, fout); /* can fail on very large files */ -+ (void) 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' -+#define a2i(p) while (isdigit(*s)) p = 10 * (p) + *s++ - '0' - - *pfrom1 = *pto1 = *pfrom2 = *pto2 = 0; - a2i(*pfrom1); -@@ -120,20 +207,25 @@ parse(s, pfrom1, pto1, pcmd, pfrom2, pto2) - *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]; - - while (n-- > 0) -- fgets(buf, sizeof buf, fin); -+ /* check for EOF in case called with HUGE */ -+ if (fgets(buf, sizeof buf, fin) == NULL) -+ return; - } - --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]; - -+ assert(fin != NULL); -+ assert(fout != NULL); -+ - while (n-- > 0) { - if (fgets(buf, sizeof buf, fin) == NULL) - return; -@@ -141,4 +233,24 @@ ncopy(fin, n, fout) /* copy n lines from fin to fout * - } - } - --#include "efopen.c" -+/* Interrupt handler */ -+void -+onintr(const int signum) -+{ -+#ifndef DEBUG -+ (void) unlink(tempfile); -+ (void) unlink(diffout); -+#endif /* DEBUG */ -+ exit(1); -+} -+ -+FILE * -+efopen(const char *file, const char *mode) /* fopen file, die if can't */ -+{ -+ FILE *fp; -+ -+ if ((fp = fopen(file, mode)) != NULL) -+ return fp; -+ err(1, "can't open file %s mode %s", file, mode); -+ /*NOTREACHED*/ -+} Index: patches/patch-testdata1 =================================================================== RCS file: patches/patch-testdata1 diff -N patches/patch-testdata1 --- patches/patch-testdata1 8 Jul 2011 09:52:50 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -$OpenBSD: patch-testdata1,v 1.2 2011/07/08 09:52:50 jasper Exp $ ---- s1.orig Tue Sep 29 17:38:18 1998 -+++ s1 Tue Sep 29 17:39:00 1998 -@@ -0,0 +1,4 @@ -+I think that I shall never see -+a computerist as happy as me. -+I once put up with System V -+But now I use Open-B-S-D. Index: patches/patch-testdata2 =================================================================== RCS file: patches/patch-testdata2 diff -N patches/patch-testdata2 --- patches/patch-testdata2 8 Jul 2011 09:52:50 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -$OpenBSD: patch-testdata2,v 1.2 2011/07/08 09:52:50 jasper Exp $ ---- s2.orig Tue Sep 29 17:38:18 1998 -+++ s2 Tue Sep 29 17:39:31 1998 -@@ -0,0 +1,4 @@ -+I think that eye shall never see -+a computerist as happy as me. -+I once put up with Cistern Vee -+But now I use OpenBSD.