Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2012 17:03:33 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r238486 - in soc2012/jhagewood/diff: . diff
Message-ID:  <20120628170333.078491065672@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Thu Jun 28 17:03:32 2012
New Revision: 238486
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238486

Log:

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

Modified: soc2012/jhagewood/diff/diff/diff.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diff.c	Thu Jun 28 16:54:10 2012	(r238485)
+++ soc2012/jhagewood/diff/diff/diff.c	Thu Jun 28 17:03:32 2012	(r238486)
@@ -49,7 +49,7 @@
 int strip_cr, suppress_cl, tabsize = 8;
 char ignore_file_case = 0;
 int	format, context, status;
-char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
+char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format;
 struct stat stb1, stb2;
 struct excludes *excludes_list;
 regex_t	 ignore_re;
@@ -323,16 +323,16 @@
 		case OPT_OLD_GF:
 		case OPT_UNCHGD_GF:
 			/* XXX To do: Coplete --GTYPE-group-format. */
-			format = D_IFDEF;
-			ifdefname = optarg;
+			format = D_GF;
+			group_format = optarg;
 			break;
 		case OPT_NEW_LF:
 		case OPT_OLD_LF:
 		case OPT_UNCHGD_LF:
 		case OPT_LF:
 			/* XXX To do: Complete --line-format. */
-			format = D_IFDEF;
-			ifdefname = optarg;
+			format = D_LF;
+			line_format = optarg;
 			break;
 		case OPT_NORMAL:
 			format = D_NORMAL;

Modified: soc2012/jhagewood/diff/diff/diff.h
==============================================================================
--- soc2012/jhagewood/diff/diff/diff.h	Thu Jun 28 16:54:10 2012	(r238485)
+++ soc2012/jhagewood/diff/diff/diff.h	Thu Jun 28 17:03:32 2012	(r238486)
@@ -48,6 +48,8 @@
 #define	D_NREVERSE	5	/* Reverse ed script with numbered
 				   lines and no trailing . */
 #define	D_BRIEF		6	/* Say if the files differ */
+#define D_GF		7	/* Group format */
+#define	D_LF		8	/* Line format */
 
 /*
  * Output flags

Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c	Thu Jun 28 16:54:10 2012	(r238485)
+++ soc2012/jhagewood/diff/diff/diffreg.c	Thu Jun 28 17:03:32 2012	(r238486)
@@ -1046,7 +1046,7 @@
 		err(1, "preadline");
 	if (nr > 0 && line[nr-1] == '\n')
 		nr--;
-	line[nr] = '\0';
+	line[nr] = '\3';
 	return (line);
 }
 
@@ -1356,9 +1356,9 @@
 	if (aflag || f == NULL)
 		return (1);
 	rewind(f);
-	for (i = 0; i <= strlen(buf) || i <= 32; i++) 
-		if (memchr(buf, '\0', strlen(buf)) != NULL)
-			return (0);
+	fread(buf, 1, BUFSIZ, f);
+	if (memchr(buf, '\0', BUFSIZ) != NULL)
+		return (0);
 	return (1);
 }
 

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Thu Jun 28 16:54:10 2012	(r238485)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Thu Jun 28 17:03:32 2012	(r238486)
@@ -1,6 +1,6 @@
 diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c
 --- jhagewood/diff/diff-orig/diff.c	2012-06-28 02:16:56.000000000 -0400
-+++ jhagewood/diff/diff/diff.c	2012-06-28 02:52:20.000000000 -0400
++++ jhagewood/diff/diff/diff.c	2012-06-28 14:21:49.000000000 -0400
 @@ -1,4 +1,4 @@
 -/*-
 +/*
@@ -44,7 +44,7 @@
 +int strip_cr, suppress_cl, tabsize = 8;
 +char ignore_file_case = 0;
 +int	format, context, status;
-+char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
++char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format;
  struct stat stb1, stb2;
  struct excludes *excludes_list;
  regex_t	 ignore_re;
@@ -243,16 +243,16 @@
 +		case OPT_OLD_GF:
 +		case OPT_UNCHGD_GF:
 +			/* XXX To do: Coplete --GTYPE-group-format. */
-+			format = D_IFDEF;
-+			ifdefname = optarg;
++			format = D_GF;
++			group_format = optarg;
 +			break;
 +		case OPT_NEW_LF:
 +		case OPT_OLD_LF:
 +		case OPT_UNCHGD_LF:
 +		case OPT_LF:
 +			/* XXX To do: Complete --line-format. */
-+			format = D_IFDEF;
-+			ifdefname = optarg;
++			format = D_LF;
++			line_format = optarg;
 +			break;
 +		case OPT_NORMAL:
 +			format = D_NORMAL;
@@ -488,8 +488,17 @@
  	    "            [-L label] file1 file2\n"
 diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h
 --- jhagewood/diff/diff-orig/diff.h	2012-06-28 02:16:56.000000000 -0400
-+++ jhagewood/diff/diff/diff.h	2012-06-28 02:16:56.000000000 -0400
-@@ -75,9 +75,9 @@ struct excludes {
++++ jhagewood/diff/diff/diff.h	2012-06-28 14:03:06.000000000 -0400
+@@ -48,6 +48,8 @@
+ #define	D_NREVERSE	5	/* Reverse ed script with numbered
+ 				   lines and no trailing . */
+ #define	D_BRIEF		6	/* Say if the files differ */
++#define D_GF		7	/* Group format */
++#define	D_LF		8	/* Line format */
+ 
+ /*
+  * Output flags
+@@ -75,9 +77,9 @@ struct excludes {
  	struct excludes	*next;
  };
  
@@ -614,7 +623,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-06-28 02:16:56.000000000 -0400
-+++ jhagewood/diff/diff/diffreg.c	2012-06-28 02:16:56.000000000 -0400
++++ jhagewood/diff/diff/diffreg.c	2012-06-28 17:03:06.000000000 -0400
 @@ -62,15 +62,13 @@
   *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
   */
@@ -966,7 +975,7 @@
  	if (a < b)
  		printf("%d,%d", a, b - a + 1);
  	else if (a == b)
-@@ -999,8 +1038,8 @@ uni_range(int a, int b)
+@@ -999,22 +1038,22 @@ uni_range(int a, int b)
  static char *
  preadline(int fd, size_t len, off_t off)
  {
@@ -977,7 +986,14 @@
  
  	line = emalloc(len + 1);
  	if ((nr = pread(fd, line, len, off)) < 0)
-@@ -1014,7 +1053,7 @@ preadline(int fd, size_t len, off_t off)
+ 		err(1, "preadline");
+ 	if (nr > 0 && line[nr-1] == '\n')
+ 		nr--;
+-	line[nr] = '\0';
++	line[nr] = '\3';
+ 	return (line);
+ }
+ 
  static int
  ignoreline(char *line)
  {
@@ -1119,7 +1135,7 @@
  
  	sum = 1;
  	space = 0;
-@@ -1305,19 +1344,20 @@ readhash(FILE *f)
+@@ -1305,20 +1344,21 @@ readhash(FILE *f)
  	return (sum == 0 ? 1 : sum);
  }
  
@@ -1142,11 +1158,13 @@
 -	cnt = fread(buf, 1, sizeof(buf), f);
 -	for (i = 0; i < cnt; i++)
 -		if (!isprint(buf[i]) && !isspace(buf[i]))
-+	for (i = 0; i <= strlen(buf) || i <= 32; i++) 
-+		if (memchr(buf, '\0', strlen(buf)) != NULL)
- 			return (0);
+-			return (0);
++	fread(buf, 1, BUFSIZ, f);
++	if (memchr(buf, '\0', BUFSIZ) != NULL)
++		return (0);
  	return (1);
  }
+ 
 @@ -1327,10 +1367,10 @@ asciifile(FILE *f)
  static char *
  match_function(const long *f, int pos, FILE *file)



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