Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jul 2012 20:52:21 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r239647 - in soc2012/jhagewood/diff3: . diff3
Message-ID:  <20120721205221.A8EB4106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Sat Jul 21 20:52:20 2012
New Revision: 239647
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239647

Log:
  Changed executable name in diff3's man file

Modified:
  soc2012/jhagewood/diff3/TODO
  soc2012/jhagewood/diff3/diff3/diff3.1
  soc2012/jhagewood/diff3/diff3/diff3prog.c
  soc2012/jhagewood/diff3/hagewood-diff3.patch

Modified: soc2012/jhagewood/diff3/TODO
==============================================================================
--- soc2012/jhagewood/diff3/TODO	Sat Jul 21 19:46:14 2012	(r239646)
+++ soc2012/jhagewood/diff3/TODO	Sat Jul 21 20:52:20 2012	(r239647)
@@ -3,7 +3,7 @@
 --merge			INCOMPLETE
 --label			INCOMPLETE
 --strip-trailing-cr	COMPLETE
---diff-program		INCOMPLETE
+--diff-program		INCOMPLETE	Pipe to diff process
 Fixed binary detection	COMPLETE
 Test script		COMPLETE
 Pipe to diff		INCOMPLETE

Modified: soc2012/jhagewood/diff3/diff3/diff3.1
==============================================================================
--- soc2012/jhagewood/diff3/diff3/diff3.1	Sat Jul 21 19:46:14 2012	(r239646)
+++ soc2012/jhagewood/diff3/diff3/diff3.1	Sat Jul 21 20:52:20 2012	(r239647)
@@ -173,7 +173,7 @@
 temporary file
 .It Pa /tmp/d3b.XXXXXXXXXX
 temporary file
-.It Pa /usr/libexec/diff3prog
+.It Pa /usr/libexec/diff3
 the actual executable
 .El
 .Sh SEE ALSO

Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c
==============================================================================
--- soc2012/jhagewood/diff3/diff3/diff3prog.c	Sat Jul 21 19:46:14 2012	(r239646)
+++ soc2012/jhagewood/diff3/diff3/diff3prog.c	Sat Jul 21 20:52:20 2012	(r239647)
@@ -132,7 +132,7 @@
  * is stored in last[1-3];
  */
 int last[4];
-int aflag, Aflag, eflag, iflag, Tflag;
+int aflag, Aflag, eflag, iflag, mflag, Tflag;
 int oflag;		/* indicates whether to mark overlaps (-E or -X)*/
 int strip_cr;
 int debug  = 0;
@@ -219,6 +219,11 @@
 			i = i <= 2 ? i : 2 ;
 			labels[i] = optarg;
 			break;
+		case 'm':
+			Aflag = 1;
+			eflag = 0;
+			mflag = 1;
+			break;
 		case 'T':
 			Tflag = 1;
 			break;
@@ -289,7 +294,7 @@
 
 	fp[0] = fopen(name, "r");
 	if (fp[0] == NULL)
-		err(EXIT_FAILURE, "can't open %s", name);
+		err(EXIT_FAILURE, "Can't open %s", name);
 	for (i=0; (p = getchange(fp[0])); i++) {
 		if (i >= szchanges - 1)
 			increase();
@@ -399,7 +404,7 @@
 		/* first file is different from others */
 		if (!t2 || (t1 && d1->new.to < d2->new.from)) {
 			/* stuff peculiar to 1st file */
-			if (eflag==0) {
+			if (eflag == 0) {
 				separate("1");
 				change(1, &d1->old, 0);
 				keep(2, &d1->new);
@@ -410,7 +415,7 @@
 		}
 		/* second file is different from others */
 		if (!t1 || (t2 && d2->new.to < d1->new.from)) {
-			if (eflag==0) {
+			if (eflag == 0) {
 				separate("2");
 				keep(1, &d2->new);
 				change(2, &d2->old, 0);
@@ -444,7 +449,7 @@
 			 * dup = 0 means all files differ
 			 * dup = 1 means files 1 and 2 identical
 			 */
-			if (eflag==0) {
+			if (eflag == 0) {
 				separate(dup ? "3" : "");
 				change(1, &d1->old, dup);
 				change(2, &d2->old, 0);

Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch
==============================================================================
--- soc2012/jhagewood/diff3/hagewood-diff3.patch	Sat Jul 21 19:46:14 2012	(r239646)
+++ soc2012/jhagewood/diff3/hagewood-diff3.patch	Sat Jul 21 20:52:20 2012	(r239647)
@@ -15,9 +15,21 @@
 +	    ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3
  
  .include <bsd.prog.mk>
+diff -rupN jhagewood/diff3/diff3-orig/diff3.1 jhagewood/diff3/diff3/diff3.1
+--- jhagewood/diff3/diff3-orig/diff3.1	2012-07-19 17:32:16.000000000 -0400
++++ jhagewood/diff3/diff3/diff3.1	2012-07-21 20:49:56.000000000 -0400
+@@ -173,7 +173,7 @@ as the temporary directory.
+ temporary file
+ .It Pa /tmp/d3b.XXXXXXXXXX
+ temporary file
+-.It Pa /usr/libexec/diff3prog
++.It Pa /usr/libexec/diff3
+ the actual executable
+ .El
+ .Sh SEE ALSO
 diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c
 --- jhagewood/diff3/diff3-orig/diff3prog.c	2012-07-19 17:32:16.000000000 -0400
-+++ jhagewood/diff3/diff3/diff3prog.c	2012-07-20 03:04:16.000000000 -0400
++++ jhagewood/diff3/diff3/diff3prog.c	2012-07-21 20:48:17.000000000 -0400
 @@ -64,19 +64,23 @@
   *	@(#)diff3.c	8.1 (Berkeley) 6/6/93
   */
@@ -49,7 +61,7 @@
  #include <wchar.h>
  #include <wctype.h>
  
-@@ -124,7 +128,7 @@ int cline[3];		/* # of the last-read lin
+@@ -124,41 +128,45 @@ int cline[3];		/* # of the last-read lin
  char *diff_prog = NULL;
  char *labels[3] = {NULL};
  /*
@@ -58,7 +70,10 @@
   * is stored in last[1-3];
   */
  int last[4];
-@@ -134,31 +138,35 @@ int strip_cr;
+-int aflag, Aflag, eflag, iflag, Tflag;
++int aflag, Aflag, eflag, iflag, mflag, Tflag;
+ int oflag;		/* indicates whether to mark overlaps (-E or -X)*/
+ int strip_cr;
  int debug  = 0;
  char f1mark[40], f2mark[40], f3mark[40];	/* markers for -E and -X */
  
@@ -144,7 +159,18 @@
  
  	eflag = 0;
  	oflag = 0;
-@@ -216,12 +225,18 @@ main(int argc, char **argv)
+@@ -210,18 +219,29 @@ main(int argc, char **argv)
+ 			i = i <= 2 ? i : 2 ;
+ 			labels[i] = optarg;
+ 			break;
++		case 'm':
++			Aflag = 1;
++			eflag = 0;
++			mflag = 1;
++			break;
+ 		case 'T':
+ 			Tflag = 1;
+ 			break;
  		case 'X':
  			oflag = eflag = 1;
  			break;
@@ -163,7 +189,7 @@
  		case STRIPCR_OPT:
  			strip_cr = 1;
  			break;
-@@ -232,10 +247,8 @@ main(int argc, char **argv)
+@@ -232,10 +252,8 @@ main(int argc, char **argv)
  	}
  	argc -= optind;
  	argv += optind;
@@ -175,7 +201,7 @@
  	if (oflag) {
  		(void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s",
  		    labels[0] != NULL ? labels[0] :  
-@@ -247,13 +260,16 @@ main(int argc, char **argv)
+@@ -247,13 +265,16 @@ main(int argc, char **argv)
  		    labels[2] != NULL ? labels[2] :
  				argc >= 7 ? argv[6] : argv[4]);
  	}
@@ -196,7 +222,7 @@
  	}
  	merge(m, n);
  	exit(EXIT_SUCCESS);
-@@ -265,7 +281,7 @@ main(int argc, char **argv)
+@@ -265,7 +286,7 @@ main(int argc, char **argv)
   * since the vector is processed in one sequential pass.
   * The vector could be optimized out of existence)
   */
@@ -205,7 +231,16 @@
  readin(char *name, struct diff **dd)
  {
  	int a, b, c, d, i;
-@@ -307,17 +323,18 @@ readin(char *name, struct diff **dd)
+@@ -273,7 +294,7 @@ readin(char *name, struct diff **dd)
+ 
+ 	fp[0] = fopen(name, "r");
+ 	if (fp[0] == NULL)
+-		err(EXIT_FAILURE, "can't open %s", name);
++		err(EXIT_FAILURE, "Can't open %s", name);
+ 	for (i=0; (p = getchange(fp[0])); i++) {
+ 		if (i >= szchanges - 1)
+ 			increase();
+@@ -307,17 +328,18 @@ readin(char *name, struct diff **dd)
  	return (i);
  }
  
@@ -226,7 +261,7 @@
  getchange(FILE *b)
  {
  	char *line;
-@@ -329,7 +346,7 @@ getchange(FILE *b)
+@@ -329,7 +351,7 @@ getchange(FILE *b)
  	return (NULL);
  }
  
@@ -235,7 +270,7 @@
  getline(FILE *b, size_t *n)
  {
  	char *cp;
-@@ -357,7 +374,7 @@ getline(FILE *b, size_t *n)
+@@ -357,7 +379,7 @@ getline(FILE *b, size_t *n)
  	return (buf);
  }
  
@@ -244,7 +279,7 @@
  merge(int m1, int m2)
  {
  	struct diff *d1, *d2, *d3;
-@@ -367,8 +384,7 @@ merge(int m1, int m2)
+@@ -367,8 +389,7 @@ merge(int m1, int m2)
  	d2 = d23;
  	j = 0;
  
@@ -254,7 +289,34 @@
  		printf("Binary file detected; comparison failed\n");
  		exit(EXIT_FAILURE);
  	}
-@@ -464,31 +480,29 @@ merge(int m1, int m2)
+@@ -383,7 +404,7 @@ merge(int m1, int m2)
+ 		/* first file is different from others */
+ 		if (!t2 || (t1 && d1->new.to < d2->new.from)) {
+ 			/* stuff peculiar to 1st file */
+-			if (eflag==0) {
++			if (eflag == 0) {
+ 				separate("1");
+ 				change(1, &d1->old, 0);
+ 				keep(2, &d1->new);
+@@ -394,7 +415,7 @@ merge(int m1, int m2)
+ 		}
+ 		/* second file is different from others */
+ 		if (!t1 || (t2 && d2->new.to < d1->new.from)) {
+-			if (eflag==0) {
++			if (eflag == 0) {
+ 				separate("2");
+ 				keep(1, &d2->new);
+ 				change(2, &d2->old, 0);
+@@ -428,7 +449,7 @@ merge(int m1, int m2)
+ 			 * dup = 0 means all files differ
+ 			 * dup = 1 means files 1 and 2 identical
+ 			 */
+-			if (eflag==0) {
++			if (eflag == 0) {
+ 				separate(dup ? "3" : "");
+ 				change(1, &d1->old, dup);
+ 				change(2, &d2->old, 0);
+@@ -464,31 +485,29 @@ merge(int m1, int m2)
  }
  
  static int
@@ -263,12 +325,12 @@
  {
 -        wint_t   ch = L'\0';
 -        size_t   i;
--
--        if (aflag || f == NULL)
--                return (1);
 +	int	i, check_size;
 +	char ch;
  
+-        if (aflag || f == NULL)
+-                return (1);
+-
 -        rewind(f);
 -        errno = 0;
 -        for (i = 0; i <= BUFSIZ; i++) {
@@ -303,7 +365,7 @@
  	printf("====%s\n", s);
  }
  
-@@ -497,9 +511,10 @@ separate(const char *s)
+@@ -497,9 +516,10 @@ separate(const char *s)
   * It is to be printed only if it does not duplicate something to be
   * printed later.
   */
@@ -315,7 +377,7 @@
  	printf("%d:", i);
  	last[i] = rold->to;
  	prange(rold);
-@@ -510,12 +525,14 @@ change(int i, struct range *rold, int du
+@@ -510,12 +530,14 @@ change(int i, struct range *rold, int du
  	(void)skip(i, rold->to, "  ");
  }
  
@@ -333,7 +395,7 @@
  	if (rold->to <= rold->from)
  		printf("%da\n", rold->from - 1);
  	else {
-@@ -531,7 +548,7 @@ prange(struct range *rold)
+@@ -531,7 +553,7 @@ prange(struct range *rold)
   * and an artificial dummy difference (trange) must be ginned up to
   * correspond to the change reported in the other file.
   */
@@ -342,7 +404,7 @@
  keep(int i, struct range *rnew)
  {
  	int delta;
-@@ -547,7 +564,7 @@ keep(int i, struct range *rnew)
+@@ -547,7 +569,7 @@ keep(int i, struct range *rnew)
   * skip to just before line number from in file "i".  If "pr" is non-NULL,
   * print all skipped stuff with string pr as a prefix.
   */
@@ -351,7 +413,7 @@
  skip(int i, int from, char *pr)
  {
  	size_t j, n;
-@@ -558,7 +575,6 @@ skip(int i, int from, char *pr)
+@@ -558,7 +580,6 @@ skip(int i, int from, char *pr)
  			trouble();
  		if (pr != NULL)
  			printf("%s%s", Tflag == 1? "\t" : pr, line);
@@ -359,7 +421,7 @@
  		cline[i]++;
  	}
  	return ((int) n);
-@@ -568,10 +584,10 @@ skip(int i, int from, char *pr)
+@@ -568,10 +589,10 @@ skip(int i, int from, char *pr)
   * Return 1 or 0 according as the old range (in file 1) contains exactly
   * the same data as the new range (in file 2).
   */
@@ -372,7 +434,7 @@
  	int nchar;
  	int nline;
  
-@@ -597,7 +613,7 @@ duplicate(struct range *r1, struct range
+@@ -597,7 +618,7 @@ duplicate(struct range *r1, struct range
  	return (1);
  }
  
@@ -381,7 +443,7 @@
  repos(int nchar)
  {
  	int i;
-@@ -606,18 +622,43 @@ repos(int nchar)
+@@ -606,18 +627,43 @@ repos(int nchar)
  		(void)fseek(fp[i], (long)-nchar, SEEK_CUR);
  }
  
@@ -427,7 +489,7 @@
  	if (((dup + 1) & eflag) == 0)
  		return (j);
  	j++;
-@@ -632,10 +673,10 @@ edit(struct diff *diff, int dup, int j)
+@@ -632,10 +678,10 @@ edit(struct diff *diff, int dup, int j)
  }
  
  /* regurgitate */
@@ -440,7 +502,7 @@
  	char block[BUFSIZ];
  
  	for (n = n; n > 0; n--) {
-@@ -657,14 +698,13 @@ edscript(int n)
+@@ -657,14 +703,13 @@ edscript(int n)
  			printf("%da\n%s\n.\n", de[n].old.from - 1, f1mark);
  		}
  	}
@@ -457,7 +519,7 @@
  increase(void)
  {
  	struct diff *p;
-@@ -698,13 +738,29 @@ increase(void)
+@@ -698,13 +743,29 @@ increase(void)
  	szchanges = newsz;
  }
  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120721205221.A8EB4106564A>