Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2012 05:19:10 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237924 - in soc2012/jhagewood/diff: . diff
Message-ID:  <20120619051910.4A96D106566C@hub.freebsd.org>

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

Log:

Modified:
  soc2012/jhagewood/diff/diff/diff.c
  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	Tue Jun 19 04:59:53 2012	(r237923)
+++ soc2012/jhagewood/diff/diff/diff.c	Tue Jun 19 05:19:09 2012	(r237924)
@@ -412,7 +412,6 @@
 
 	if (n == 0)
 		errx(2, NULL);
-
 	if ((p = malloc(n)) == NULL)
 		errx(2, NULL);
 	return (p);
@@ -443,7 +442,6 @@
 	va_start(ap, fmt);
 	len = vasprintf(ret, fmt, ap);
 	va_end(ap);
-
 	if (len < 0 || *ret == NULL)
 		errx(2, NULL);
 	return (len);
@@ -457,6 +455,7 @@
 
 	len = strlen(str) + 1;
 	cp = emalloc(len);
+	
 	strlcpy(cp, str, len);
 	return (cp);
 }
@@ -537,6 +536,7 @@
 void
 print_only(const char *path, size_t dirlen, const char *entry)
 {
+	
 	if (dirlen > 1)
 		dirlen--;
 	printf("Only in %.*s: %s\n", (int)dirlen, path, entry);
@@ -547,45 +547,45 @@
 {
 	
 	switch (val) {
-		case D_ONLY:
-			print_only(path1, strlen(path1), entry);
-			break;
-		case D_COMMON:
-			printf("Common subdirectories: %s%s and %s%s\n",
-				path1, entry ? entry : "", path2, entry ? entry : "");
-			break;
-		case D_BINARY:
+	case D_ONLY:
+		print_only(path1, strlen(path1), entry);
+		break;
+	case D_COMMON:
+		printf("Common subdirectories: %s%s and %s%s\n",
+			path1, entry ? entry : "", path2, entry ? entry : "");
+		break;
+	case D_BINARY:
+		printf("Files %s%s and %s%s differ\n",
+			path1, entry ? entry : "", path2, entry ? entry : "");
+		break;
+	case D_DIFFER:
+		if (format == D_BRIEF)
 			printf("Files %s%s and %s%s differ\n",
-				path1, entry ? entry : "", path2, entry ? entry : "");
-			break;
-		case D_DIFFER:
-			if (format == D_BRIEF)
-				printf("Files %s%s and %s%s differ\n",
-					path1, entry ? entry : "",
-					path2, entry ? entry : "");
-			break;
-		case D_SAME:
-			if (sflag)
-				printf("Files %s%s and %s%s are identical\n",
-					path1, entry ? entry : "",
-					path2, entry ? entry : "");
-			break;
-		case D_MISMATCH1:
-			printf("File %s%s is a directory while file %s%s is a regular file\n",
-				path1, entry ? entry : "", path2, entry ? entry : "");
-			break;
-		case D_MISMATCH2:
-			printf("File %s%s is a regular file while file %s%s is a directory\n",
-				path1, entry ? entry : "", path2, entry ? entry : "");
-			break;
-		case D_SKIPPED1:
-			printf("File %s%s is not a regular file or directory and was skipped\n",
-				path1, entry ? entry : "");
-			break;
-		case D_SKIPPED2:
-			printf("File %s%s is not a regular file or directory and was skipped\n",
+				path1, entry ? entry : "",
+				path2, entry ? entry : "");
+		break;
+	case D_SAME:
+		if (sflag)
+			printf("Files %s%s and %s%s are identical\n",
+				path1, entry ? entry : "",
 				path2, entry ? entry : "");
-			break;
+		break;
+	case D_MISMATCH1:
+		printf("File %s%s is a directory while file %s%s is a regular file\n",
+			path1, entry ? entry : "", path2, entry ? entry : "");
+		break;
+	case D_MISMATCH2:
+		printf("File %s%s is a regular file while file %s%s is a directory\n",
+			path1, entry ? entry : "", path2, entry ? entry : "");
+		break;
+	case D_SKIPPED1:
+		printf("File %s%s is not a regular file or directory and was skipped\n",
+			path1, entry ? entry : "");
+		break;
+	case D_SKIPPED2:
+		printf("File %s%s is not a regular file or directory and was skipped\n",
+			path2, entry ? entry : "");
+		break;
 	}
 }
 

Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c	Tue Jun 19 04:59:53 2012	(r237923)
+++ soc2012/jhagewood/diff/diff/diffreg.c	Tue Jun 19 05:19:09 2012	(r237924)
@@ -62,15 +62,13 @@
  *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
  */
 
-#include <sys/cdefs.h>
-
-#ifndef lint
 #if 0
-__RCSID("$OpenBSD: diffreg.c,v 1.70 2007/09/11 15:47:17 gilles Exp $");
-#else
-__FBSDID("$FreeBSD");
+#ifndef lint
+static char sccsid[] = "@(#)diffreg.c	8.1 (Berkeley) 6/6/93";
 #endif
 #endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -300,13 +298,13 @@
 int
 diffreg(char *ofile1, char *ofile2, int flags)
 {
-	char	*file1 = ofile1;
-	char	*file2 = ofile2;
-	FILE	*f1 = NULL;
-	FILE	*f2 = NULL;
-	int	 rval = D_SAME;
-	int	 i, ostdout = -1;
-	pid_t	 pid = -1;
+	char *file1 = ofile1;
+	char *file2 = ofile2;
+	FILE *f1 = NULL;
+	FILE *f2 = NULL;
+	int	rval = D_SAME;
+	int	i, ostdout = -1;
+	pid_t pid = -1;
 
 	anychange = 0;
 	lastline = 0;
@@ -482,8 +480,8 @@
 static int
 files_differ(FILE *f1, FILE *f2, int flags)
 {
-	char	 buf1[BUFSIZ], buf2[BUFSIZ];
-	size_t	 i, j;
+	char buf1[BUFSIZ], buf2[BUFSIZ];
+	size_t i, j;
 
 	if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size ||
 	    (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT))
@@ -508,9 +506,9 @@
 static FILE *
 opentemp(const char *file)
 {
-	char	 buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN];
-	ssize_t	 nread;
-	int	 ifd, ofd;
+	char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN];
+	ssize_t nread;
+	int ifd, ofd;
 
 	if (strcmp(file, "-") == 0)
 		ifd = STDIN_FILENO;
@@ -546,7 +544,7 @@
 char *
 splice(char *dir, char *file)
 {
-	char	*tail, *buf;
+	char *tail, *buf;
 
 	if ((tail = strrchr(file, '/')) == NULL)
 		tail = file;
@@ -560,8 +558,8 @@
 prepare(int i, FILE *fd, off_t filesize)
 {
 	struct line	*p;
-	int		 j, h;
-	size_t		 sz;
+	int	j, h;
+	size_t sz;
 
 	rewind(fd);
 
@@ -584,7 +582,7 @@
 static void
 prune(void)
 {
-	int	 i, j;
+	int	i, j;
 
 	for (pref = 0; pref < len[0] && pref < len[1] &&
 	    file[0][pref + 1].value == file[1][pref + 1].value;
@@ -605,7 +603,7 @@
 static void
 equiv(struct line *a, int n, struct line *b, int m, int *c)
 {
-	int	 i, j;
+	int	i, j;
 
 	i = j = 1;
 	while (i <= n && j <= m) {
@@ -634,7 +632,7 @@
 static int
 isqrt(int n)
 {
-	int	 y, x = 1;
+	int	y, x = 1;
 
 	if (n == 0)
 		return (0);
@@ -652,9 +650,9 @@
 static int
 stone(int *a, int n, int *b, int *c)
 {
-	int	 i, k, y, j, l;
-	int	 oldc, tc, oldl;
-	u_int	 numtries;
+	int i, k, y, j, l;
+	int	oldc, tc, oldl;
+	u_int numtries;
 	const u_int bound = dflag ? UINT_MAX : MAX(256, isqrt(n));
 
 	k = 0;
@@ -710,7 +708,7 @@
 static int
 search(int *c, int k, int y)
 {
-	int	 i, j, l, t;
+	int	i, j, l, t;
 
 	if (clist[c[k]].y < y)	/* quick look for typical case */
 		return (k + 1);
@@ -735,7 +733,7 @@
 unravel(int p)
 {
 	struct cand	*q;
-	int		 i;
+	int	i;
 
 	for (i = 0; i <= len[0]; i++)
 		J[i] = i <= pref ? i :
@@ -913,7 +911,7 @@
 sort(struct line *a, int n)
 {
 	struct line	*ai, *aim, w;
-	int		 j, m = 0, k;
+	int	j, m = 0, k;
 
 	if (n == 0)
 		return;
@@ -957,7 +955,7 @@
 static int
 skipline(FILE *f)
 {
-	int	 i, c;
+	int	i, c;
 
 	for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++)
 		continue;
@@ -967,7 +965,7 @@
 static void
 output(char *file1, FILE *f1, char *file2, FILE *f2, int flags)
 {
-	int	 m, i0, i1, j0, j1;
+	int m, i0, i1, j0, j1;
 
 	rewind(f1);
 	rewind(f2);
@@ -1021,6 +1019,7 @@
 static void
 range(int a, int b, char *separator)
 {
+	
 	printf("%d", a > b ? b : a);
 	if (a < b)
 		printf("%s%d", separator, b);
@@ -1029,6 +1028,7 @@
 static void
 uni_range(int a, int b)
 {
+	
 	if (a < b)
 		printf("%d,%d", a, b - a + 1);
 	else if (a == b)
@@ -1040,8 +1040,8 @@
 static char *
 preadline(int fd, size_t len, off_t off)
 {
-	char	*line;
-	ssize_t	 nr;
+	char *line;
+	ssize_t nr;
 
 	line = emalloc(len + 1);
 	if ((nr = pread(fd, line, len, off)) < 0)
@@ -1055,7 +1055,7 @@
 static int
 ignoreline(char *line)
 {
-	int	 ret;
+	int ret;
 
 	ret = regexec(&ignore_re, line, 0, NULL, 0);
 	free(line);
@@ -1073,8 +1073,8 @@
 change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
     int *pflags)
 {
-	static size_t	 max_context = 64;
-	int		 i;
+	static size_t max_context = 64;
+	int	i;
 
 restart:
 	if (format != D_IFDEF && a > b && c > d)
@@ -1206,8 +1206,8 @@
 static int
 fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile)
 {
-	int	 i, j, c, lastc, col, nc;
-	int	 newcol;
+	int	i, j, c, lastc, col, nc;
+	int	newcol;
 
 	/*
 	 * When doing #ifdef's, copy down to current line
@@ -1287,8 +1287,8 @@
 static int
 readhash(FILE *f)
 {
-	int	 i, t, space;
-	int	 sum;
+	int	i, t, space;
+	int	sum;
 
 	sum = 1;
 	space = 0;
@@ -1349,12 +1349,11 @@
 static int
 asciifile(FILE *f)
 {
-	char		 buf[BUFSIZ];
-	int		 i, cnt;
+	char buf[BUFSIZ];
+	int	i, cnt;
 
 	if (aflag || f == NULL)
 		return (1);
-
 	rewind(f);
 	cnt = fread(buf, 1, sizeof(buf), f);
 	for (i = 0; i < cnt; i++)
@@ -1368,10 +1367,10 @@
 static char *
 match_function(const long *f, int pos, FILE *file)
 {
-	char		 buf[FUNCTION_CONTEXT_SIZE];
-	size_t		 nc;
-	int		 last = lastline;
-	char		*state = NULL;
+	char buf[FUNCTION_CONTEXT_SIZE];
+	size_t nc;
+	int	last = lastline;
+	char *state = NULL;
 
 	lastline = pos;
 	while (pos > last) {
@@ -1383,7 +1382,6 @@
 		if (nc > 0) {
 			buf[nc] = '\0';
 			buf[strcspn(buf, "\n")] = '\0';
-
 			if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
 				if (begins_with(buf, "private:")) {
 					if (!state)
@@ -1414,9 +1412,9 @@
 dump_context_vec(FILE *f1, FILE *f2)
 {
 	struct context_vec *cvp = context_vec_start;
-	int		 lowa, upb, lowc, upd, do_output;
-	int		 a, b, c, d;
-	char		 ch, *f;
+	int	lowa, upb, lowc, upd, do_output;
+	int a, b, c, d;
+	char ch, *f;
 
 	if (context_vec_start > context_vec_ptr)
 		return;
@@ -1519,9 +1517,9 @@
 dump_unified_vec(FILE *f1, FILE *f2)
 {
 	struct context_vec *cvp = context_vec_start;
-	int		 lowa, upb, lowc, upd;
-	int		 a, b, c, d;
-	char		 ch, *f;
+	int	lowa, upb, lowc, upd;
+	int	a, b, c, d;
+	char ch, *f;
 
 	if (context_vec_start > context_vec_ptr)
 		return;
@@ -1592,7 +1590,7 @@
 static void
 print_header(const char *file1, const char *file2)
 {
-	const char  *time_format;
+	const char *time_format;
 	char buf1[256];
 	char buf2[256];
 	char end1[10];

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Tue Jun 19 04:59:53 2012	(r237923)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Tue Jun 19 05:19:09 2012	(r237924)
@@ -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-18 03:07:38.000000000 -0400
-+++ jhagewood/diff/diff/diff.c	2012-06-19 04:59:23.000000000 -0400
++++ jhagewood/diff/diff/diff.c	2012-06-19 05:12:45.000000000 -0400
 @@ -18,15 +18,13 @@
   * Materiel Command, USAF, under agreement number F39502-99-1-0512.
   */
@@ -135,7 +135,7 @@
  		case OPT_TSIZE:
                          if (optarg != NULL) {
                                  l = strtol(optarg, &ep, 10);
-@@ -402,7 +408,7 @@ main(int argc, char **argv)
+@@ -402,11 +408,10 @@ main(int argc, char **argv)
  void *
  emalloc(size_t n)
  {
@@ -144,7 +144,11 @@
  
  	if (n == 0)
  		errx(2, NULL);
-@@ -415,7 +421,7 @@ emalloc(size_t n)
+-
+ 	if ((p = malloc(n)) == NULL)
+ 		errx(2, NULL);
+ 	return (p);
+@@ -415,7 +420,7 @@ emalloc(size_t n)
  void *
  erealloc(void *p, size_t n)
  {
@@ -153,7 +157,7 @@
  
  	if (n == 0)
  		errx(2, NULL);
-@@ -431,8 +437,8 @@ erealloc(void *p, size_t n)
+@@ -431,13 +436,12 @@ erealloc(void *p, size_t n)
  int
  easprintf(char **ret, const char *fmt, ...)
  {
@@ -164,7 +168,12 @@
  
  	va_start(ap, fmt);
  	len = vasprintf(ret, fmt, ap);
-@@ -446,8 +452,8 @@ easprintf(char **ret, const char *fmt, .
+ 	va_end(ap);
+-
+ 	if (len < 0 || *ret == NULL)
+ 		errx(2, NULL);
+ 	return (len);
+@@ -446,11 +450,12 @@ easprintf(char **ret, const char *fmt, .
  char *
  estrdup(const char *str)
  {
@@ -175,92 +184,77 @@
  
  	len = strlen(str) + 1;
  	cp = emalloc(len);
-@@ -539,52 +545,54 @@ print_only(const char *path, size_t dirl
++	
+ 	strlcpy(cp, str, len);
+ 	return (cp);
+ }
+@@ -531,6 +536,7 @@ push_ignore_pats(char *pattern)
+ void
+ print_only(const char *path, size_t dirlen, const char *entry)
+ {
++	
+ 	if (dirlen > 1)
+ 		dirlen--;
+ 	printf("Only in %.*s: %s\n", (int)dirlen, path, entry);
+@@ -539,45 +545,46 @@ print_only(const char *path, size_t dirl
  void
  print_status(int val, char *path1, char *path2, char *entry)
  {
 +	
  	switch (val) {
--	case D_ONLY:
--		print_only(path1, strlen(path1), entry);
--		break;
--	case D_COMMON:
--		printf("Common subdirectories: %s%s and %s%s\n",
+ 	case D_ONLY:
+ 		print_only(path1, strlen(path1), entry);
+ 		break;
+ 	case D_COMMON:
+ 		printf("Common subdirectories: %s%s and %s%s\n",
 -		    path1, entry ? entry : "", path2, entry ? entry : "");
--		break;
--	case D_BINARY:
++			path1, entry ? entry : "", path2, entry ? entry : "");
+ 		break;
+ 	case D_BINARY:
 -		printf("Binary files %s%s and %s%s differ\n",
 -		    path1, entry ? entry : "", path2, entry ? entry : "");
--		break;
--	case D_DIFFER:
--		if (format == D_BRIEF)
-+		case D_ONLY:
-+			print_only(path1, strlen(path1), entry);
-+			break;
-+		case D_COMMON:
-+			printf("Common subdirectories: %s%s and %s%s\n",
-+				path1, entry ? entry : "", path2, entry ? entry : "");
-+			break;
-+		case D_BINARY:
++		printf("Files %s%s and %s%s differ\n",
++			path1, entry ? entry : "", path2, entry ? entry : "");
+ 		break;
+ 	case D_DIFFER:
+ 		if (format == D_BRIEF)
  			printf("Files %s%s and %s%s differ\n",
 -			    path1, entry ? entry : "",
 -			    path2, entry ? entry : "");
--		break;
--	case D_SAME:
--		if (sflag)
--			printf("Files %s%s and %s%s are identical\n",
++				path1, entry ? entry : "",
++				path2, entry ? entry : "");
+ 		break;
+ 	case D_SAME:
+ 		if (sflag)
+ 			printf("Files %s%s and %s%s are identical\n",
 -			    path1, entry ? entry : "",
 -			    path2, entry ? entry : "");
--		break;
--	case D_MISMATCH1:
--		printf("File %s%s is a directory while file %s%s is a regular file\n",
++				path1, entry ? entry : "",
++				path2, entry ? entry : "");
+ 		break;
+ 	case D_MISMATCH1:
+ 		printf("File %s%s is a directory while file %s%s is a regular file\n",
 -		    path1, entry ? entry : "", path2, entry ? entry : "");
--		break;
--	case D_MISMATCH2:
--		printf("File %s%s is a regular file while file %s%s is a directory\n",
++			path1, entry ? entry : "", path2, entry ? entry : "");
+ 		break;
+ 	case D_MISMATCH2:
+ 		printf("File %s%s is a regular file while file %s%s is a directory\n",
 -		    path1, entry ? entry : "", path2, entry ? entry : "");
--		break;
--	case D_SKIPPED1:
--		printf("File %s%s is not a regular file or directory and was skipped\n",
++			path1, entry ? entry : "", path2, entry ? entry : "");
+ 		break;
+ 	case D_SKIPPED1:
+ 		printf("File %s%s is not a regular file or directory and was skipped\n",
 -		    path1, entry ? entry : "");
--		break;
--	case D_SKIPPED2:
--		printf("File %s%s is not a regular file or directory and was skipped\n",
++			path1, entry ? entry : "");
+ 		break;
+ 	case D_SKIPPED2:
+ 		printf("File %s%s is not a regular file or directory and was skipped\n",
 -		    path2, entry ? entry : "");
--		break;
-+				path1, entry ? entry : "", path2, entry ? entry : "");
-+			break;
-+		case D_DIFFER:
-+			if (format == D_BRIEF)
-+				printf("Files %s%s and %s%s differ\n",
-+					path1, entry ? entry : "",
-+					path2, entry ? entry : "");
-+			break;
-+		case D_SAME:
-+			if (sflag)
-+				printf("Files %s%s and %s%s are identical\n",
-+					path1, entry ? entry : "",
-+					path2, entry ? entry : "");
-+			break;
-+		case D_MISMATCH1:
-+			printf("File %s%s is a directory while file %s%s is a regular file\n",
-+				path1, entry ? entry : "", path2, entry ? entry : "");
-+			break;
-+		case D_MISMATCH2:
-+			printf("File %s%s is a regular file while file %s%s is a directory\n",
-+				path1, entry ? entry : "", path2, entry ? entry : "");
-+			break;
-+		case D_SKIPPED1:
-+			printf("File %s%s is not a regular file or directory and was skipped\n",
-+				path1, entry ? entry : "");
-+			break;
-+		case D_SKIPPED2:
-+			printf("File %s%s is not a regular file or directory and was skipped\n",
-+				path2, entry ? entry : "");
-+			break;
++			path2, entry ? entry : "");
+ 		break;
  	}
  }
- 
+@@ -585,6 +592,7 @@ print_status(int val, char *path1, char 
  void
  usage(void)
  {
@@ -282,8 +276,28 @@
  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-19 04:44:02.000000000 -0400
-@@ -90,6 +90,12 @@ __FBSDID("$FreeBSD");
++++ jhagewood/diff/diff/diffreg.c	2012-06-19 05:18:57.000000000 -0400
+@@ -62,15 +62,13 @@
+  *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
+  */
+ 
+-#include <sys/cdefs.h>
+-
+-#ifndef lint
+ #if 0
+-__RCSID("$OpenBSD: diffreg.c,v 1.70 2007/09/11 15:47:17 gilles Exp $");
+-#else
+-__FBSDID("$FreeBSD");
++#ifndef lint
++static char sccsid[] = "@(#)diffreg.c	8.1 (Berkeley) 6/6/93";
+ #endif
+ #endif /* not lint */
++#include <sys/cdefs.h>
++__FBSDID("$FreeBSD$");
+ 
+ #include <sys/param.h>
+ #include <sys/stat.h>
+@@ -90,6 +88,12 @@ __FBSDID("$FreeBSD");
  #include "diff.h"
  #include "pathnames.h"
  
@@ -296,7 +310,28 @@
  /*
   * diff - compare two files.
   */
-@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int 
+@@ -294,13 +298,13 @@ u_char cup2low[256] = {
+ int
+ diffreg(char *ofile1, char *ofile2, int flags)
+ {
+-	char	*file1 = ofile1;
+-	char	*file2 = ofile2;
+-	FILE	*f1 = NULL;
+-	FILE	*f2 = NULL;
+-	int	 rval = D_SAME;
+-	int	 i, ostdout = -1;
+-	pid_t	 pid = -1;
++	char *file1 = ofile1;
++	char *file2 = ofile2;
++	FILE *f1 = NULL;
++	FILE *f2 = NULL;
++	int	rval = D_SAME;
++	int	i, ostdout = -1;
++	pid_t pid = -1;
+ 
+ 	anychange = 0;
+ 	lastline = 0;
+@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int 
  		status |= 2;
  		goto closem;
  	}
@@ -304,7 +339,109 @@
  	switch (files_differ(f1, f2, flags)) {
  	case 0:
  		goto closem;
-@@ -748,9 +753,10 @@ unravel(int p)
+@@ -477,8 +480,8 @@ closem:
+ static int
+ files_differ(FILE *f1, FILE *f2, int flags)
+ {
+-	char	 buf1[BUFSIZ], buf2[BUFSIZ];
+-	size_t	 i, j;
++	char buf1[BUFSIZ], buf2[BUFSIZ];
++	size_t i, j;
+ 
+ 	if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size ||
+ 	    (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT))
+@@ -503,9 +506,9 @@ files_differ(FILE *f1, FILE *f2, int fla
+ static FILE *
+ opentemp(const char *file)
+ {
+-	char	 buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN];
+-	ssize_t	 nread;
+-	int	 ifd, ofd;
++	char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN];
++	ssize_t nread;
++	int ifd, ofd;
+ 
+ 	if (strcmp(file, "-") == 0)
+ 		ifd = STDIN_FILENO;
+@@ -541,7 +544,7 @@ opentemp(const char *file)
+ char *
+ splice(char *dir, char *file)
+ {
+-	char	*tail, *buf;
++	char *tail, *buf;
+ 
+ 	if ((tail = strrchr(file, '/')) == NULL)
+ 		tail = file;
+@@ -555,8 +558,8 @@ static void
+ prepare(int i, FILE *fd, off_t filesize)
+ {
+ 	struct line	*p;
+-	int		 j, h;
+-	size_t		 sz;
++	int	j, h;
++	size_t sz;
+ 
+ 	rewind(fd);
+ 
+@@ -579,7 +582,7 @@ prepare(int i, FILE *fd, off_t filesize)
+ static void
+ prune(void)
+ {
+-	int	 i, j;
++	int	i, j;
+ 
+ 	for (pref = 0; pref < len[0] && pref < len[1] &&
+ 	    file[0][pref + 1].value == file[1][pref + 1].value;
+@@ -600,7 +603,7 @@ prune(void)
+ static void
+ equiv(struct line *a, int n, struct line *b, int m, int *c)
+ {
+-	int	 i, j;
++	int	i, j;
+ 
+ 	i = j = 1;
+ 	while (i <= n && j <= m) {
+@@ -629,7 +632,7 @@ equiv(struct line *a, int n, struct line
+ static int
+ isqrt(int n)
+ {
+-	int	 y, x = 1;
++	int	y, x = 1;
+ 
+ 	if (n == 0)
+ 		return (0);
+@@ -647,9 +650,9 @@ isqrt(int n)
+ static int
+ stone(int *a, int n, int *b, int *c)
+ {
+-	int	 i, k, y, j, l;
+-	int	 oldc, tc, oldl;
+-	u_int	 numtries;
++	int i, k, y, j, l;
++	int	oldc, tc, oldl;
++	u_int numtries;
+ 	const u_int bound = dflag ? UINT_MAX : MAX(256, isqrt(n));
+ 
+ 	k = 0;
+@@ -705,7 +708,7 @@ newcand(int x, int y, int pred)
+ static int
+ search(int *c, int k, int y)
+ {
+-	int	 i, j, l, t;
++	int	i, j, l, t;
+ 
+ 	if (clist[c[k]].y < y)	/* quick look for typical case */
+ 		return (k + 1);
+@@ -730,7 +733,7 @@ static void
+ unravel(int p)
+ {
+ 	struct cand	*q;
+-	int		 i;
++	int	i;
+ 
+ 	for (i = 0; i <= len[0]; i++)
+ 		J[i] = i <= pref ? i :
+@@ -748,9 +751,10 @@ unravel(int p)
  static void
  check(char *file1, FILE *f1, char *file2, FILE *f2)
  {
@@ -318,7 +455,7 @@
  	rewind(f1);
  	rewind(f2);
  	j = 1;
-@@ -766,7 +772,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -766,7 +770,7 @@ check(char *file1, FILE *f1, char *file2
  			ixnew[j] = ctnew += skipline(f2);
  			j++;
  		}
@@ -327,7 +464,7 @@
  			for (;;) {
  				c = getc(f1);
  				d = getc(f2);
-@@ -781,6 +787,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -781,6 +785,7 @@ check(char *file1, FILE *f1, char *file2
  				}
  				ctold++;
  				ctnew++;
@@ -335,7 +472,7 @@
  				if (bflag && isspace(c) && isspace(d)) {
  					do {
  						if (c == '\n')
-@@ -792,6 +799,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -792,6 +797,7 @@ check(char *file1, FILE *f1, char *file2
  							break;
  						ctnew++;
  					} while (isspace(d = getc(f2)));
@@ -343,7 +480,7 @@
  				} else if (wflag) {
  					while (isspace(c) && c != '\n') {
  						c = getc(f1);
-@@ -801,31 +809,64 @@ check(char *file1, FILE *f1, char *file2
+@@ -801,31 +807,64 @@ check(char *file1, FILE *f1, char *file2
  						d = getc(f2);
  						ctnew++;
  					}
@@ -417,11 +554,171 @@
  				if (chrtran[c] != chrtran[d]) {
  					jackpot++;
  					J[i] = 0;
-@@ -1551,16 +1592,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -872,7 +911,7 @@ static void
+ sort(struct line *a, int n)
+ {
+ 	struct line	*ai, *aim, w;
+-	int		 j, m = 0, k;
++	int	j, m = 0, k;
+ 
+ 	if (n == 0)
+ 		return;
+@@ -916,7 +955,7 @@ unsort(struct line *f, int l, int *b)
+ static int
+ skipline(FILE *f)
+ {
+-	int	 i, c;
++	int	i, c;
+ 
+ 	for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++)
+ 		continue;
+@@ -926,7 +965,7 @@ skipline(FILE *f)
+ static void
+ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags)
+ {
+-	int	 m, i0, i1, j0, j1;
++	int m, i0, i1, j0, j1;
+ 
+ 	rewind(f1);
+ 	rewind(f2);
+@@ -980,6 +1019,7 @@ output(char *file1, FILE *f1, char *file
+ static void
+ range(int a, int b, char *separator)
+ {
++	
+ 	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)
+ static void
+ uni_range(int a, int b)
+ {
++	
+ 	if (a < b)
+ 		printf("%d,%d", a, b - a + 1);
+ 	else if (a == b)
+@@ -999,8 +1040,8 @@ uni_range(int a, int b)
+ static char *
+ preadline(int fd, size_t len, off_t off)
+ {
+-	char	*line;
+-	ssize_t	 nr;
++	char *line;
++	ssize_t nr;
+ 
+ 	line = emalloc(len + 1);
+ 	if ((nr = pread(fd, line, len, off)) < 0)
+@@ -1014,7 +1055,7 @@ preadline(int fd, size_t len, off_t off)
+ static int
+ ignoreline(char *line)
+ {
+-	int	 ret;
++	int ret;
+ 
+ 	ret = regexec(&ignore_re, line, 0, NULL, 0);
+ 	free(line);
+@@ -1032,8 +1073,8 @@ static void
+ change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
+     int *pflags)
+ {
+-	static size_t	 max_context = 64;
+-	int		 i;
++	static size_t max_context = 64;
++	int	i;
+ 
+ restart:
+ 	if (format != D_IFDEF && a > b && c > d)
+@@ -1165,8 +1206,8 @@ proceed:
+ static int
+ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile)
+ {
+-	int	 i, j, c, lastc, col, nc;
+-	int	 newcol;
++	int	i, j, c, lastc, col, nc;
++	int	newcol;
+ 
+ 	/*
+ 	 * When doing #ifdef's, copy down to current line
+@@ -1246,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, i
+ static int
+ readhash(FILE *f)
+ {
+-	int	 i, t, space;
+-	int	 sum;
++	int	i, t, space;
++	int	sum;
+ 
+ 	sum = 1;
+ 	space = 0;
+@@ -1308,12 +1349,11 @@ readhash(FILE *f)
+ static int
+ asciifile(FILE *f)
+ {
+-	char		 buf[BUFSIZ];
+-	int		 i, cnt;
++	char buf[BUFSIZ];
++	int	i, cnt;
+ 
+ 	if (aflag || f == NULL)
+ 		return (1);
+-
+ 	rewind(f);
+ 	cnt = fread(buf, 1, sizeof(buf), f);
+ 	for (i = 0; i < cnt; i++)
+@@ -1327,10 +1367,10 @@ asciifile(FILE *f)
+ static char *
+ match_function(const long *f, int pos, FILE *file)
+ {
+-	char		 buf[FUNCTION_CONTEXT_SIZE];
+-	size_t		 nc;
+-	int		 last = lastline;
+-	char		*state = NULL;
++	char buf[FUNCTION_CONTEXT_SIZE];
++	size_t nc;
++	int	last = lastline;
++	char *state = NULL;
+ 
+ 	lastline = pos;
+ 	while (pos > last) {
+@@ -1342,7 +1382,6 @@ match_function(const long *f, int pos, F
+ 		if (nc > 0) {
+ 			buf[nc] = '\0';
+ 			buf[strcspn(buf, "\n")] = '\0';
+-
+ 			if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
+ 				if (begins_with(buf, "private:")) {
+ 					if (!state)
+@@ -1373,9 +1412,9 @@ static void
+ dump_context_vec(FILE *f1, FILE *f2)
+ {
+ 	struct context_vec *cvp = context_vec_start;
+-	int		 lowa, upb, lowc, upd, do_output;
+-	int		 a, b, c, d;
+-	char		 ch, *f;
++	int	lowa, upb, lowc, upd, do_output;
++	int a, b, c, d;
++	char ch, *f;
+ 
+ 	if (context_vec_start > context_vec_ptr)
+ 		return;
+@@ -1478,9 +1517,9 @@ static void
+ dump_unified_vec(FILE *f1, FILE *f2)
+ {
+ 	struct context_vec *cvp = context_vec_start;
+-	int		 lowa, upb, lowc, upd;
+-	int		 a, b, c, d;
+-	char		 ch, *f;
++	int	lowa, upb, lowc, upd;
++	int	a, b, c, d;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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