socsvn commit: r239048 - in soc2012/jhagewood/diff: . diff

jhagewood at FreeBSD.org jhagewood at FreeBSD.org
Fri Jul 6 17:31:30 UTC 2012


Author: jhagewood
Date: Fri Jul  6 17:31:27 2012
New Revision: 239048
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239048

Log:

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

Modified: soc2012/jhagewood/diff/TODO
==============================================================================
--- soc2012/jhagewood/diff/TODO	Fri Jul  6 16:54:25 2012	(r239047)
+++ soc2012/jhagewood/diff/TODO	Fri Jul  6 17:31:27 2012	(r239048)
@@ -31,6 +31,16 @@
 - The -ignore-*-* options need some work.
 - BUG: BSD diff seg faults when another longopt is used with '--side-by-side'. FIX: When passing args to sdiff for side-by-side mode, only the 
 	short option '-y' was excluded. Added '--side-by-side' as an exception also.
+- --ignore-*-* options
+	-WORKING
+		--ignore-all-space
+		--ignore-case
+		--ignore-file-name-case
+		--ignore-matching-lines
+		--ignore-space-change
+	-NOT WORKING
+		--ignore-blank-lines
+		--ignore-tab-expansion
 
 - line formats:
 

Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c	Fri Jul  6 16:54:25 2012	(r239047)
+++ soc2012/jhagewood/diff/diff/diffreg.c	Fri Jul  6 17:31:27 2012	(r239048)
@@ -811,21 +811,14 @@
 					}
 				/* ignore-blank-lines */
 				} else if (Bflag) {
-					if (c == '\n' && d != '\n') {
-						do {
-							if (c == '\n') {
-								ctold++; 
-							}
-						} while ((c = getc(f1)) == '\n');
+					while (isspace(c) && c == '\n') {
+						c = getc(f1);
+						ctold++;
 					}
-					if (d == '\n' && c != '\n') {
-						do {
-							if (d == '\n') {
-								ctnew++;
-							}
-						} while ((d = getc(f2)) == '\n');
+					while (isspace(d) && d == '\n') {
+						d = getc(f2);
+						ctnew++;
 					}
-					break;
 				/* ignore-tab-expansion */
 				} else if (Eflag) {
 					if (isspace(c) && isspace(d)) {

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Fri Jul  6 16:54:25 2012	(r239047)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Fri Jul  6 17:31:27 2012	(r239048)
@@ -688,7 +688,7 @@
  	if (stat(path1, &stb1) != 0) {
 diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c
 --- jhagewood/diff/diff-orig/diffreg.c	2012-07-02 15:05:57.000000000 -0400
-+++ jhagewood/diff/diff/diffreg.c	2012-07-05 04:19:42.000000000 -0400
++++ jhagewood/diff/diff/diffreg.c	2012-07-06 17:30:59.000000000 -0400
 @@ -62,15 +62,13 @@
   *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
   */
@@ -912,7 +912,7 @@
  				} else if (wflag) {
  					while (isspace(c) && c != '\n') {
  						c = getc(f1);
-@@ -801,31 +809,62 @@ check(char *file1, FILE *f1, char *file2
+@@ -801,31 +809,55 @@ check(char *file1, FILE *f1, char *file2
  						d = getc(f2);
  						ctnew++;
  					}
@@ -921,33 +921,27 @@
  				} else if (Bflag) {
 -					if( c == '\n' && d != '\n') {
 -
-+					if (c == '\n' && d != '\n') {
- 						do {
- 							if (c == '\n') {
+-						do {
+-							if (c == '\n') {
 -							      ixold[i] = ctold; 
 -							      i++;
-+								ctold++; 
- 							}
+-							}
 -
 -						} while ((c = getc(f1)) == '\n' && i <= len[0]);
-+						} while ((c = getc(f1)) == '\n');
++					while (isspace(c) && c == '\n') {
++						c = getc(f1);
++						ctold++;
  					}
 -
 -					if( d == '\n' && c != '\n') {
-+					if (d == '\n' && c != '\n') {
- 						do {
- 							if (d == '\n') {
+-						do {
+-							if (d == '\n') {
 -								ixnew[j] = ctnew;
 -								j++;
-+								ctnew++;
- 							}
--						} while ((d = getc(f2)) == '\n' && j <= len[1]);
--		
-+						} while ((d = getc(f2)) == '\n');
- 					}
--			
- 					break;
--				}
++					while (isspace(d) && d == '\n') {
++						d = getc(f2);
++						ctnew++;
++					}
 +				/* ignore-tab-expansion */
 +				} else if (Eflag) {
 +					if (isspace(c) && isspace(d)) {
@@ -961,7 +955,9 @@
 +								c = getc(f1);
 +								if (c != ' ')
 +									break;
-+							}
+ 							}
+-						} while ((d = getc(f2)) == '\n' && j <= len[1]);
+-		
 +							fsetpos(f1, &position);
 +							while (c == ' ' && spacecount == 9) {
 +								c = getc(f1);
@@ -985,12 +981,15 @@
 +								ctnew++;
 +							}
 +						}
-+					}
+ 					}
+-			
+-					break;
+-				}
 +				} 
  				if (chrtran[c] != chrtran[d]) {
  					jackpot++;
  					J[i] = 0;
-@@ -872,7 +911,7 @@ static void
+@@ -872,7 +904,7 @@ static void
  sort(struct line *a, int n)
  {
  	struct line	*ai, *aim, w;
@@ -999,7 +998,7 @@
  
  	if (n == 0)
  		return;
-@@ -916,7 +955,7 @@ unsort(struct line *f, int l, int *b)
+@@ -916,7 +948,7 @@ unsort(struct line *f, int l, int *b)
  static int
  skipline(FILE *f)
  {
@@ -1008,7 +1007,7 @@
  
  	for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++)
  		continue;
-@@ -926,7 +965,7 @@ skipline(FILE *f)
+@@ -926,7 +958,7 @@ skipline(FILE *f)
  static void
  output(char *file1, FILE *f1, char *file2, FILE *f2, int flags)
  {
@@ -1017,7 +1016,7 @@
  
  	rewind(f1);
  	rewind(f2);
-@@ -965,7 +1004,7 @@ output(char *file1, FILE *f1, char *file
+@@ -965,7 +997,7 @@ output(char *file1, FILE *f1, char *file
  #define	c i0
  			if ((c = getc(f1)) == EOF)
  				return;
@@ -1026,7 +1025,7 @@
  		}
  #undef c
  	}
-@@ -980,6 +1019,7 @@ output(char *file1, FILE *f1, char *file
+@@ -980,6 +1012,7 @@ output(char *file1, FILE *f1, char *file
  static void
  range(int a, int b, char *separator)
  {
@@ -1034,7 +1033,7 @@
  	printf("%d", a > b ? b : a);
  	if (a < b)
  		printf("%s%d", separator, b);
-@@ -988,6 +1028,7 @@ range(int a, int b, char *separator)
+@@ -988,6 +1021,7 @@ range(int a, int b, char *separator)
  static void
  uni_range(int a, int b)
  {
@@ -1042,7 +1041,7 @@
  	if (a < b)
  		printf("%d,%d", a, b - a + 1);
  	else if (a == b)
-@@ -999,22 +1040,22 @@ uni_range(int a, int b)
+@@ -999,22 +1033,22 @@ uni_range(int a, int b)
  static char *
  preadline(int fd, size_t len, off_t off)
  {
@@ -1069,7 +1068,7 @@
  
  	ret = regexec(&ignore_re, line, 0, NULL, 0);
  	free(line);
-@@ -1032,8 +1073,8 @@ static void
+@@ -1032,8 +1066,8 @@ static void
  change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
      int *pflags)
  {
@@ -1080,7 +1079,7 @@
  
  restart:
  	if (format != D_IFDEF && a > b && c > d)
-@@ -1113,15 +1154,15 @@ proceed:
+@@ -1113,15 +1147,15 @@ proceed:
  	case D_NORMAL:
  	case D_EDIT:
  		range(a, b, ",");
@@ -1100,7 +1099,7 @@
  		break;
  	case D_NREVERSE:
  		if (a > b)
-@@ -1137,7 +1178,7 @@ proceed:
+@@ -1137,7 +1171,7 @@ proceed:
  	if (format == D_NORMAL || format == D_IFDEF) {
  		fetch(ixold, a, b, f1, '<', 1);
  		if (a <= b && c <= d && format == D_NORMAL)
@@ -1109,7 +1108,7 @@
  	}
  	i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0);
  	if (i != 0 && format == D_EDIT) {
-@@ -1148,14 +1189,14 @@ proceed:
+@@ -1148,14 +1182,14 @@ proceed:
  		 * it.  We have to add a substitute command to change this
  		 * back and restart where we left off.
  		 */
@@ -1126,7 +1125,7 @@
  	if (inifdef) {
  		printf("#endif /* %s */\n", ifdefname);
  		inifdef = 0;
-@@ -1165,8 +1206,8 @@ proceed:
+@@ -1165,8 +1199,8 @@ proceed:
  static int
  fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile)
  {
@@ -1137,7 +1136,7 @@
  
  	/*
  	 * When doing #ifdef's, copy down to current line
-@@ -1177,7 +1218,7 @@ fetch(long *f, int a, int b, FILE *lb, i
+@@ -1177,7 +1211,7 @@ fetch(long *f, int a, int b, FILE *lb, i
  		/* print through if append (a>b), else to (nb: 0 vs 1 orig) */
  		nc = f[a > b ? b : a - 1] - curpos;
  		for (i = 0; i < nc; i++)
@@ -1146,7 +1145,7 @@
  	}
  	if (a > b)
  		return (0);
-@@ -1197,12 +1238,12 @@ fetch(long *f, int a, int b, FILE *lb, i
+@@ -1197,12 +1231,12 @@ fetch(long *f, int a, int b, FILE *lb, i
  		fseek(lb, f[i - 1], SEEK_SET);
  		nc = f[i] - f[i - 1];
  		if (format != D_IFDEF && ch != '\0') {
@@ -1162,7 +1161,7 @@
  		}
  		col = 0;
  		for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) {
-@@ -1211,13 +1252,13 @@ fetch(long *f, int a, int b, FILE *lb, i
+@@ -1211,13 +1245,13 @@ fetch(long *f, int a, int b, FILE *lb, i
  				    format == D_NREVERSE)
  					warnx("No newline at end of file");
  				else
@@ -1178,7 +1177,7 @@
  				} while (++col < newcol);
  			} else {
  				if (format == D_EDIT && j == 1 && c == '\n'
-@@ -1229,10 +1270,10 @@ fetch(long *f, int a, int b, FILE *lb, i
+@@ -1229,10 +1263,10 @@ fetch(long *f, int a, int b, FILE *lb, i
  					 * giving the caller an offset
  					 * from which to restart.
  					 */
@@ -1191,7 +1190,7 @@
  				col++;
  			}
  		}
-@@ -1246,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, i
+@@ -1246,8 +1280,8 @@ fetch(long *f, int a, int b, FILE *lb, i
  static int
  readhash(FILE *f)
  {
@@ -1202,7 +1201,7 @@
  
  	sum = 1;
  	space = 0;
-@@ -1305,20 +1346,28 @@ readhash(FILE *f)
+@@ -1305,20 +1339,28 @@ readhash(FILE *f)
  	return (sum == 0 ? 1 : sum);
  }
  
@@ -1238,7 +1237,7 @@
  	return (1);
  }
  
-@@ -1327,10 +1376,10 @@ asciifile(FILE *f)
+@@ -1327,10 +1369,10 @@ asciifile(FILE *f)
  static char *
  match_function(const long *f, int pos, FILE *file)
  {
@@ -1253,7 +1252,7 @@
  
  	lastline = pos;
  	while (pos > last) {
-@@ -1342,7 +1391,6 @@ match_function(const long *f, int pos, F
+@@ -1342,7 +1384,6 @@ match_function(const long *f, int pos, F
  		if (nc > 0) {
  			buf[nc] = '\0';
  			buf[strcspn(buf, "\n")] = '\0';
@@ -1261,7 +1260,7 @@
  			if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
  				if (begins_with(buf, "private:")) {
  					if (!state)
-@@ -1373,9 +1421,9 @@ static void
+@@ -1373,9 +1414,9 @@ static void
  dump_context_vec(FILE *f1, FILE *f2)
  {
  	struct context_vec *cvp = context_vec_start;
@@ -1274,7 +1273,7 @@
  
  	if (context_vec_start > context_vec_ptr)
  		return;
-@@ -1390,8 +1438,8 @@ dump_context_vec(FILE *f1, FILE *f2)
+@@ -1390,8 +1431,8 @@ dump_context_vec(FILE *f1, FILE *f2)
  	if (pflag) {
  		f = match_function(ixold, lowa-1, f1);
  		if (f != NULL) {
@@ -1285,7 +1284,7 @@
  		}
  	}
  	printf("\n*** ");
-@@ -1478,9 +1526,9 @@ static void
+@@ -1478,9 +1519,9 @@ static void
  dump_unified_vec(FILE *f1, FILE *f2)
  {
  	struct context_vec *cvp = context_vec_start;
@@ -1298,7 +1297,7 @@
  
  	if (context_vec_start > context_vec_ptr)
  		return;
-@@ -1491,19 +1539,19 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1491,19 +1532,19 @@ dump_unified_vec(FILE *f1, FILE *f2)
  	lowc = MAX(1, cvp->c - context);
  	upd = MIN(len[1], context_vec_ptr->d + context);
  
@@ -1324,7 +1323,7 @@
  
  	/*
  	 * Output changes in "unified" diff format--the old and new lines
-@@ -1551,16 +1599,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1551,16 +1592,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
  static void
  print_header(const char *file1, const char *file2)
  {


More information about the svn-soc-all mailing list