Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2012 03:09:42 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237920 - in soc2012/jhagewood/diff: . diff
Message-ID:  <20120619030942.DAA9A106566B@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Tue Jun 19 03:09:41 2012
New Revision: 237920
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237920

Log:

Modified:
  soc2012/jhagewood/diff/diff/diffreg.c
  soc2012/jhagewood/diff/hagewood-diff.patch

Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c	Tue Jun 19 02:54:54 2012	(r237919)
+++ soc2012/jhagewood/diff/diff/diffreg.c	Tue Jun 19 03:09:41 2012	(r237920)
@@ -359,7 +359,6 @@
 		status |= 2;
 		goto closem;
 	}
-
 	switch (files_differ(f1, f2, flags)) {
 	case 0:
 		goto closem;
@@ -754,14 +753,12 @@
 static void
 check(char *file1, FILE *f1, char *file2, FILE *f2)
 {
-	int	i, j, jackpot, c, d, spacetab;
+	int	i, j, jackpot, c, d;
 	long ctold, ctnew;
-	fpos_t position;
 
 	rewind(f1);
 	rewind(f2);
 	j = 1;
-	spacetab = 1;
 	ixold[0] = ixnew[0] = 0;
 	jackpot = 0;
 	ctold = ctnew = 0;
@@ -829,33 +826,24 @@
 					}
 					break;
 				/* ignore-tab-expansion */
-				} /*else if (Eflag) {
-					if (c == '\t' && d == ' ') {
-						fgetpos(f2, &position);
-						for (j = 1; j <= 7; j++) {
-							d = getc(f2);
-							if (d != " ") 
-								spacetab = 0;
-						}
-						fsetpos(f2, &position);
-						if (spacetab) {
-
-						}	
+				} else if (Eflag) {
+				if (isspace(c) && isspace(d)) {
+					if (d == '\t') {
+						do {
+							if (c != ' ')
+								break;
+							ctold++;
+						} while (isspace(c = getc(f1)));
 					}
-					if (d == '\t' && c == ' ') {
-						fgetpos(f1, &position);
-						for (j = 1; j <= 7; j++) {
-							c = getc(f2);
-							if (c != " ") 
-								spacetab = 0;
-						}
-						fsetpos(f1, &position);
-						if (spacetab) {
-
-						}	
+				}
+					if (c == '\t') {
+						do {
+							if (d != ' ')
+								break;
+							ctnew++;
+						} while (isspace(d = getc(f2)));
 					}
-					break;
-				} */
+				} 
 				if (chrtran[c] != chrtran[d]) {
 					jackpot++;
 					J[i] = 0;

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Tue Jun 19 02:54:54 2012	(r237919)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Tue Jun 19 03:09:41 2012	(r237920)
@@ -123,7 +123,7 @@
  extern int	 format, context, status;
 diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c
 --- jhagewood/diff/diff-orig/diffreg.c	2012-06-18 03:07:38.000000000 -0400
-+++ jhagewood/diff/diff/diffreg.c	2012-06-18 03:07:38.000000000 -0400
++++ jhagewood/diff/diff/diffreg.c	2012-06-19 03:08:39.000000000 -0400
 @@ -90,6 +90,12 @@ __FBSDID("$FreeBSD");
  #include "diff.h"
  #include "pathnames.h"
@@ -137,24 +137,26 @@
  /*
   * diff - compare two files.
   */
-@@ -748,12 +754,14 @@ unravel(int p)
+@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int 
+ 		status |= 2;
+ 		goto closem;
+ 	}
+-
+ 	switch (files_differ(f1, f2, flags)) {
+ 	case 0:
+ 		goto closem;
+@@ -748,8 +753,8 @@ unravel(int p)
  static void
  check(char *file1, FILE *f1, char *file2, FILE *f2)
  {
 -	int	 i, j, jackpot, c, d;
 -	long	 ctold, ctnew;
-+	int	i, j, jackpot, c, d, spacetab;
++	int	i, j, jackpot, c, d;
 +	long ctold, ctnew;
-+	fpos_t position;
  
  	rewind(f1);
  	rewind(f2);
- 	j = 1;
-+	spacetab = 1;
- 	ixold[0] = ixnew[0] = 0;
- 	jackpot = 0;
- 	ctold = ctnew = 0;
-@@ -766,7 +774,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -766,7 +771,7 @@ check(char *file1, FILE *f1, char *file2
  			ixnew[j] = ctnew += skipline(f2);
  			j++;
  		}
@@ -163,7 +165,7 @@
  			for (;;) {
  				c = getc(f1);
  				d = getc(f2);
-@@ -803,29 +811,51 @@ check(char *file1, FILE *f1, char *file2
+@@ -803,29 +808,42 @@ check(char *file1, FILE *f1, char *file2
  					}
  
  				} else if (Bflag) {
@@ -191,39 +193,29 @@
  					}
 -			
  					break;
--				}
 +				/* ignore-tab-expansion */
-+				} /*else if (Eflag) {
-+					if (c == '\t' && d == ' ') {
-+						fgetpos(f2, &position);
-+						for (j = 1; j <= 7; j++) {
-+							d = getc(f2);
-+							if (d != " ") 
-+								spacetab = 0;
-+						}
-+						fsetpos(f2, &position);
-+						if (spacetab) {
-+
-+						}	
++				} else if (Eflag) {
++				if (isspace(c) && isspace(d)) {
++					if (d == '\t') {
++						do {
++							if (c != ' ')
++								break;
++							ctold++;
++						} while (isspace(c = getc(f1)));
 +					}
-+					if (d == '\t' && c == ' ') {
-+						fgetpos(f1, &position);
-+						for (j = 1; j <= 7; j++) {
-+							c = getc(f2);
-+							if (c != " ") 
-+								spacetab = 0;
-+						}
-+						fsetpos(f1, &position);
-+						if (spacetab) {
-+
-+						}	
+ 				}
++					if (c == '\t') {
++						do {
++							if (d != ' ')
++								break;
++							ctnew++;
++						} while (isspace(d = getc(f2)));
 +					}
-+					break;
-+				} */
++				} 
  				if (chrtran[c] != chrtran[d]) {
  					jackpot++;
  					J[i] = 0;
-@@ -1551,16 +1581,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1551,16 +1569,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
  static void
  print_header(const char *file1, const char *file2)
  {



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