Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2012 20:57:01 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237776 - in soc2012/jhagewood: diff diff/diff diff3
Message-ID:  <20120615205701.2B9221065673@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Fri Jun 15 20:57:00 2012
New Revision: 237776
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237776

Log:

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

Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c	Fri Jun 15 19:42:49 2012	(r237775)
+++ soc2012/jhagewood/diff/diff/diffreg.c	Fri Jun 15 20:57:00 2012	(r237776)
@@ -90,6 +90,12 @@
 #include "diff.h"
 #include "pathnames.h"
 
+#ifdef ST_MTIM_NSEC
+# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC)
+#else
+# define TIMESPEC_NS(timespec) 0
+#endif
+
 /*
  * diff - compare two files.
  */
@@ -823,7 +829,7 @@
 					}
 					break;
 				/* ignore-tab-expansion */
-				} else if (Eflag) {
+				} /*else if (Eflag) {
 					if (c == '\t' && d == ' ') {
 						fgetpos(f2, &position);
 						for (j = 1; j <= 7; j++) {
@@ -833,7 +839,7 @@
 						}
 						fsetpos(f2, &position);
 						if (spacetab) {
-							/* Ignore tab expression? */
+
 						}	
 					}
 					if (d == '\t' && c == ' ') {
@@ -845,11 +851,11 @@
 						}
 						fsetpos(f1, &position);
 						if (spacetab) {
-							/* Ignore tab expression? */
+
 						}	
 					}
 					break;
-				}
+				} */
 				if (chrtran[c] != chrtran[d]) {
 					jackpot++;
 					J[i] = 0;
@@ -1576,13 +1582,18 @@
 print_header(const char *file1, const char *file2)
 {
 	const char  *time_format;
-	struct tm *tm_ptr1, *tm_ptr2;
 	char buf1[256];
 	char buf2[256];
+	char end1[10];
+	char end2[10];
+	struct tm *tm_ptr1, *tm_ptr2;
+	int nsec1 = TIMESPEC_NS (stb1.st_mtime);
+	int nsec2 = TIMESPEC_NS (stb2.st_mtime);
+	
 #ifdef ST_MTIM_NSEC
-		time_format = "%Y-%m-%d %H:%M:%S.%N %z";
+		time_format = "%Y-%m-%d %H:%M:%S.%N";
 #else
-		time_format = "%Y-%m-%d %H:%M:%S %z";
+		time_format = "%Y-%m-%d %H:%M:%S";
 #endif	
 	
 	if (cflag) 
@@ -1591,7 +1602,10 @@
 	tm_ptr2 = localtime(&stb2.st_mtime);
 	strftime(buf1, 256, time_format, tm_ptr1);
 	strftime(buf2, 256, time_format, tm_ptr2);
-
+	strftime(end1, 10, "%z", tm_ptr1);
+	strftime(end2, 10, "%z", tm_ptr2);
+	sprintf(buf1, "%s.%.9d %s", buf1, nsec1, end1);
+	sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2);
 	if (label[0] != NULL)
 		printf("%s %s\n", format == D_CONTEXT ? "***" : "---",
 			label[0]);

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Fri Jun 15 19:42:49 2012	(r237775)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Fri Jun 15 20:57:00 2012	(r237776)
@@ -82,8 +82,21 @@
  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-10 03:31:05.000000000 -0400
-+++ jhagewood/diff/diff/diffreg.c	2012-06-14 04:59:34.000000000 -0400
-@@ -748,12 +748,14 @@ unravel(int p)
++++ jhagewood/diff/diff/diffreg.c	2012-06-15 20:54:20.000000000 -0400
+@@ -90,6 +90,12 @@ __FBSDID("$FreeBSD");
+ #include "diff.h"
+ #include "pathnames.h"
+ 
++#ifdef ST_MTIM_NSEC
++# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC)
++#else
++# define TIMESPEC_NS(timespec) 0
++#endif
++
+ /*
+  * diff - compare two files.
+  */
+@@ -748,12 +754,14 @@ unravel(int p)
  static void
  check(char *file1, FILE *f1, char *file2, FILE *f2)
  {
@@ -100,7 +113,7 @@
  	ixold[0] = ixnew[0] = 0;
  	jackpot = 0;
  	ctold = ctnew = 0;
-@@ -766,7 +768,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -766,7 +774,7 @@ check(char *file1, FILE *f1, char *file2
  			ixnew[j] = ctnew += skipline(f2);
  			j++;
  		}
@@ -109,7 +122,7 @@
  			for (;;) {
  				c = getc(f1);
  				d = getc(f2);
-@@ -803,27 +805,49 @@ check(char *file1, FILE *f1, char *file2
+@@ -803,29 +811,51 @@ check(char *file1, FILE *f1, char *file2
  					}
  
  				} else if (Bflag) {
@@ -136,9 +149,10 @@
 -		
  					}
 -			
-+					break;
+ 					break;
+-				}
 +				/* ignore-tab-expansion */
-+				} else if (Eflag) {
++				} /*else if (Eflag) {
 +					if (c == '\t' && d == ' ') {
 +						fgetpos(f2, &position);
 +						for (j = 1; j <= 7; j++) {
@@ -148,7 +162,7 @@
 +						}
 +						fsetpos(f2, &position);
 +						if (spacetab) {
-+							/* Ignore tab expression? */
++
 +						}	
 +					}
 +					if (d == '\t' && c == ' ') {
@@ -160,13 +174,15 @@
 +						}
 +						fsetpos(f1, &position);
 +						if (spacetab) {
-+							/* Ignore tab expression? */
++
 +						}	
 +					}
- 					break;
- 				}
++					break;
++				} */
  				if (chrtran[c] != chrtran[d]) {
-@@ -859,7 +883,7 @@ check(char *file1, FILE *f1, char *file2
+ 					jackpot++;
+ 					J[i] = 0;
+@@ -859,7 +889,7 @@ check(char *file1, FILE *f1, char *file2
  		ixnew[j] = ctnew;
  		j++;
  	}
@@ -175,18 +191,23 @@
  		ixnew[j] = ctnew += skipline(f2);
  	/*
  	 * if (jackpot)
-@@ -1551,16 +1575,33 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1551,16 +1581,41 @@ dump_unified_vec(FILE *f1, FILE *f2)
  static void
  print_header(const char *file1, const char *file2)
  {
 +	const char  *time_format;
-+	struct tm *tm_ptr1, *tm_ptr2;
 +	char buf1[256];
 +	char buf2[256];
++	char end1[10];
++	char end2[10];
++	struct tm *tm_ptr1, *tm_ptr2;
++	int nsec1 = TIMESPEC_NS (stb1.st_mtime);
++	int nsec2 = TIMESPEC_NS (stb2.st_mtime);
++	
 +#ifdef ST_MTIM_NSEC
-+		time_format = "%Y-%m-%d %H:%M:%S.%N %z";
++		time_format = "%Y-%m-%d %H:%M:%S.%N";
 +#else
-+		time_format = "%Y-%m-%d %H:%M:%S %z";
++		time_format = "%Y-%m-%d %H:%M:%S";
 +#endif	
 +	
 +	if (cflag) 
@@ -195,7 +216,10 @@
 +	tm_ptr2 = localtime(&stb2.st_mtime);
 +	strftime(buf1, 256, time_format, tm_ptr1);
 +	strftime(buf2, 256, time_format, tm_ptr2);
-+
++	strftime(end1, 10, "%z", tm_ptr1);
++	strftime(end2, 10, "%z", tm_ptr2);
++	sprintf(buf1, "%s.%.9d %s", buf1, nsec1, end1);
++	sprintf(buf2, "%s.%.9d %s", buf2, nsec2, end2);
  	if (label[0] != NULL)
  		printf("%s %s\n", format == D_CONTEXT ? "***" : "---",
 -		    label[0]);

Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch
==============================================================================
--- soc2012/jhagewood/diff3/hagewood-diff3.patch	Fri Jun 15 19:42:49 2012	(r237775)
+++ soc2012/jhagewood/diff3/hagewood-diff3.patch	Fri Jun 15 20:57:00 2012	(r237776)
@@ -11,7 +11,7 @@
  .include <bsd.prog.mk>
 diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c
 --- jhagewood/diff3/diff3-orig/diff3prog.c	2012-06-14 05:32:21.000000000 -0400
-+++ jhagewood/diff3/diff3/diff3prog.c	2012-06-15 18:22:42.000000000 -0400
++++ jhagewood/diff3/diff3/diff3prog.c	2012-06-15 18:23:03.000000000 -0400
 @@ -64,19 +64,23 @@
   *	@(#)diff3.c	8.1 (Berkeley) 6/6/93
   */
@@ -24,7 +24,7 @@
  #endif
 +#endif /* not lint */
 +#include <sys/cdefs.h>
-+__FBSDID("$FreeBSD: soc2012/jhagewood/diff3/diff3/diff3prog.c 237728 2012-06-14 21:17:35Z jhagewood $");
++__FBSDID("$FreeBSD: soc2012/jhagewood/diff3/diff3/diff3prog.c 237773 2012-06-15 18:23:01Z jhagewood $");
  
 +#include <ctype.h>
 +#include <err.h>



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