socsvn commit: r237922 - in soc2012/jhagewood/diff: . diff
jhagewood at FreeBSD.org
jhagewood at FreeBSD.org
Tue Jun 19 04:44:27 UTC 2012
Author: jhagewood
Date: Tue Jun 19 04:44:24 2012
New Revision: 237922
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237922
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 Tue Jun 19 03:47:25 2012 (r237921)
+++ soc2012/jhagewood/diff/TODO Tue Jun 19 04:44:24 2012 (r237922)
@@ -2,6 +2,7 @@
--unified GNU compatibility COMPLETE Fixed timestamp.
--context GNU compatibility COMPLETE Fixed timestamp, will test more.
+--ignore-blank-lines IN PROGRESS Was already implemented in check(), but has weird outputs.
--left-column INCOMPLETE
--show-function-line INCOMPLETE
--unidirectional-new-file INCOMPLETE
@@ -14,9 +15,10 @@
--to-file INCOMPLETE
--horizontal-lines INCOMPLETE
--speed-large-file INCOMPLETE
---ignore-tab-expansion IN PROGRESS
+--ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?)
--width INCOMPLETE
Notes:
- When using large files as input, diff will only output "Files [file1] and [file2] differ."
+- With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff.
Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 03:47:25 2012 (r237921)
+++ soc2012/jhagewood/diff/diff/diffreg.c Tue Jun 19 04:44:24 2012 (r237922)
@@ -753,9 +753,10 @@
static void
check(char *file1, FILE *f1, char *file2, FILE *f2)
{
- int i, j, jackpot, c, d;
+ int i, j, jackpot, c, d, int spacecount;
long ctold, ctnew;
-
+ fpos_t position;
+
rewind(f1);
rewind(f2);
j = 1;
@@ -830,14 +831,36 @@
/* ignore-tab-expansion */
} else if (Eflag) {
if (isspace(c) && isspace(d)) {
- if (d == '\t') {
- while (c == ' ') {
+ if (d == '\t' && c == ' ') {
+ /*
+ * Checks if file1 has 8 consecutive spaces, which is
+ * equal to 1 tab.
+ */
+ getpos(f1, &position);
+ for (spacecount = 1; spacecount <= 8; spacecount++) {
+ c = getc(f1);
+ if (c != ' ')
+ break;
+ }
+ setpos(f1, &position);
+ while (c == ' ' && spacecount == 9) {
c = getc(f1);
ctold++;
}
}
- if (c == '\t') {
- while (d == ' ') {
+ if (c == '\t' && d == ' ') {
+ /*
+ * Checks if file2 has 8 consecutive spaces, which is
+ * equal to 1 tab.
+ */
+ getpos(f2, &position);
+ for (spacecount = 1; spacecount <= 8; spacecount++) {
+ d = getc(f2);
+ if (d != ' ')
+ break;
+ }
+ setpos(f2, &position);
+ while (d == ' ' && spacecount == 9) {
d = getc(f2);
ctnew++;
}
Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 03:47:25 2012 (r237921)
+++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:44:24 2012 (r237922)
@@ -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-19 03:46:25.000000000 -0400
++++ jhagewood/diff/diff/diffreg.c 2012-06-19 04:44:02.000000000 -0400
@@ -90,6 +90,12 @@ __FBSDID("$FreeBSD");
#include "diff.h"
#include "pathnames.h"
@@ -145,18 +145,21 @@
switch (files_differ(f1, f2, flags)) {
case 0:
goto closem;
-@@ -748,8 +753,8 @@ unravel(int p)
+@@ -748,9 +753,10 @@ 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;
+-
++ int i, j, jackpot, c, d, int spacecount;
+ long ctold, ctnew;
-
++ fpos_t position;
++
rewind(f1);
rewind(f2);
-@@ -766,7 +771,7 @@ check(char *file1, FILE *f1, char *file2
+ j = 1;
+@@ -766,7 +772,7 @@ check(char *file1, FILE *f1, char *file2
ixnew[j] = ctnew += skipline(f2);
j++;
}
@@ -165,7 +168,7 @@
for (;;) {
c = getc(f1);
d = getc(f2);
-@@ -781,6 +786,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -781,6 +787,7 @@ check(char *file1, FILE *f1, char *file2
}
ctold++;
ctnew++;
@@ -173,7 +176,7 @@
if (bflag && isspace(c) && isspace(d)) {
do {
if (c == '\n')
-@@ -792,6 +798,7 @@ check(char *file1, FILE *f1, char *file2
+@@ -792,6 +799,7 @@ check(char *file1, FILE *f1, char *file2
break;
ctnew++;
} while (isspace(d = getc(f2)));
@@ -181,7 +184,7 @@
} else if (wflag) {
while (isspace(c) && c != '\n') {
c = getc(f1);
-@@ -801,31 +808,42 @@ check(char *file1, FILE *f1, char *file2
+@@ -801,31 +809,64 @@ check(char *file1, FILE *f1, char *file2
d = getc(f2);
ctnew++;
}
@@ -216,14 +219,36 @@
+ /* ignore-tab-expansion */
+ } else if (Eflag) {
+ if (isspace(c) && isspace(d)) {
-+ if (d == '\t') {
-+ while (c == ' ') {
++ if (d == '\t' && c == ' ') {
++ /*
++ * Checks if file1 has 8 consecutive spaces, which is
++ * equal to 1 tab.
++ */
++ getpos(f1, &position);
++ for (spacecount = 1; spacecount <= 8; spacecount++) {
++ c = getc(f1);
++ if (c != ' ')
++ break;
++ }
++ setpos(f1, &position);
++ while (c == ' ' && spacecount == 9) {
+ c = getc(f1);
+ ctold++;
+ }
+ }
-+ if (c == '\t') {
-+ while (d == ' ') {
++ if (c == '\t' && d == ' ') {
++ /*
++ * Checks if file2 has 8 consecutive spaces, which is
++ * equal to 1 tab.
++ */
++ getpos(f2, &position);
++ for (spacecount = 1; spacecount <= 8; spacecount++) {
++ d = getc(f2);
++ if (d != ' ')
++ break;
++ }
++ setpos(f2, &position);
++ while (d == ' ' && spacecount == 9) {
+ d = getc(f2);
+ ctnew++;
+ }
@@ -233,7 +258,7 @@
if (chrtran[c] != chrtran[d]) {
jackpot++;
J[i] = 0;
-@@ -1551,16 +1569,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