Date: Thu, 14 Jun 2012 04:25:26 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r237652 - in soc2012/jhagewood/diff: . diff Message-ID: <20120614042526.42861106566C@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhagewood Date: Thu Jun 14 04:25:25 2012 New Revision: 237652 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237652 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 Thu Jun 14 03:27:01 2012 (r237651) +++ soc2012/jhagewood/diff/diff/diff.c Thu Jun 14 04:25:25 2012 (r237652) @@ -48,7 +48,7 @@ int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; int sflag, tflag, Tflag, wflag; int Bflag, yflag; -int strip_cr, tabsize=8; +int strip_cr, tabsize = 8; char ignore_file_case = 0; int format, context, status; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; @@ -58,7 +58,7 @@ int flag_opts = 0; -#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" +#define OPTIONS "0123456789aBbC:cdD:EefhI:iL:lnNPpqrS:sTtU:uvwXy:x" /* Options which exceed manageable alphanumeric assignments */ Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Thu Jun 14 03:27:01 2012 (r237651) +++ soc2012/jhagewood/diff/diff/diffreg.c Thu Jun 14 04:25:25 2012 (r237652) @@ -748,12 +748,14 @@ 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, spacetab; + long ctold, ctnew; + fpos_t position; rewind(f1); rewind(f2); j = 1; + spacetab = 1; ixold[0] = ixnew[0] = 0; jackpot = 0; ctold = ctnew = 0; @@ -820,24 +822,33 @@ } while ((d = getc(f2)) == '\n' && j <= len[1]); } break; - /* TODO : ignore-tab-expansion */ + /* ignore-tab-expansion */ } else if (Eflag) { if (c == '\t' && d == ' ') { - do { - if (c == '\t') { - ixold[i] = ctold; - i++; - } - } while ((c = getc(f1)) == '\t' && i <= len[0]); + fgetpos(f2, &position); + for (j = 1; j <= 7; j++) { + d = getc(f2); + if (d != " ") + spacetab = 0; + } + fsetpos(f2, &position); + if (spacetab) { + /* Ignore tab expression? */ + } } if (d == '\t' && c == ' ') { - do { - if (d == '\t') { - ixnew[j] = ctnew; - j++; - } - } while ((d = getc(f2)) == '\t' && j <= len[1]); + fgetpos(f2, &position); + for (j = 1; j <= 7; j++) { + d = getc(f2); + if (d != " ") + spacetab = 0; + } + fsetpos(f2, &position); + if (spacetab) { + /* Ignore tab expression? */ + } } + break; } if (chrtran[c] != chrtran[d]) { jackpot++; @@ -872,7 +883,7 @@ ixnew[j] = ctnew; j++; } - for (; j <= len[1]; j++) + for (j = 1; j <= len[1]; j++) ixnew[j] = ctnew += skipline(f2); /* * if (jackpot) Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 14 03:27:01 2012 (r237651) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 14 04:25:25 2012 (r237652) @@ -1,7 +1,7 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-10 03:31:05.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-13 05:07:54.000000000 -0400 -@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); ++++ jhagewood/diff/diff/diff.c 2012-06-14 04:01:37.000000000 -0400 +@@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -9,7 +9,20 @@ +int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; int sflag, tflag, Tflag, wflag; int Bflag, yflag; - int strip_cr, tabsize=8; +-int strip_cr, tabsize=8; ++int strip_cr, tabsize = 8; + char ignore_file_case = 0; + int format, context, status; + char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +@@ -58,7 +58,7 @@ regex_t ignore_re; + + int flag_opts = 0; + +-#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" ++#define OPTIONS "0123456789aBbC:cdD:EefhI:iL:lnNPpqrS:sTtU:uvwXy:x" + + + /* Options which exceed manageable alphanumeric assignments */ @@ -109,8 +109,7 @@ static struct option longopts[] = { { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, @@ -69,8 +82,25 @@ 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-13 20:53:55.000000000 -0400 -@@ -766,7 +766,7 @@ check(char *file1, FILE *f1, char *file2 ++++ jhagewood/diff/diff/diffreg.c 2012-06-14 04:22:08.000000000 -0400 +@@ -748,12 +748,14 @@ 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, spacetab; ++ long ctold, ctnew; ++ fpos_t position; + + rewind(f1); + rewind(f2); + j = 1; ++ spacetab = 1; + ixold[0] = ixnew[0] = 0; + jackpot = 0; + ctold = ctnew = 0; +@@ -766,7 +768,7 @@ check(char *file1, FILE *f1, char *file2 ixnew[j] = ctnew += skipline(f2); j++; } @@ -79,7 +109,7 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -803,28 +803,41 @@ check(char *file1, FILE *f1, char *file2 +@@ -803,27 +805,49 @@ check(char *file1, FILE *f1, char *file2 } } else if (Bflag) { @@ -106,29 +136,46 @@ - } - - break; -+ /* TODO : ignore-tab-expansion */ ++ break; ++ /* ignore-tab-expansion */ + } else if (Eflag) { + if (c == '\t' && d == ' ') { -+ do { -+ if (c == '\t') { -+ ixold[i] = ctold; -+ i++; -+ } -+ } while ((c = getc(f1)) == '\t' && i <= len[0]); ++ fgetpos(f2, &position); ++ for (j = 1; j <= 7; j++) { ++ d = getc(f2); ++ if (d != " ") ++ spacetab = 0; ++ } ++ fsetpos(f2, &position); ++ if (spacetab) { ++ /* Ignore tab expression? */ ++ } + } + if (d == '\t' && c == ' ') { -+ do { -+ if (d == '\t') { -+ ixnew[j] = ctnew; -+ j++; -+ } -+ } while ((d = getc(f2)) == '\t' && j <= len[1]); ++ fgetpos(f2, &position); ++ for (j = 1; j <= 7; j++) { ++ d = getc(f2); ++ if (d != " ") ++ spacetab = 0; ++ } ++ fsetpos(f2, &position); ++ if (spacetab) { ++ /* Ignore tab expression? */ ++ } + } + break; } if (chrtran[c] != chrtran[d]) { - jackpot++; -@@ -1551,16 +1564,33 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -859,7 +883,7 @@ check(char *file1, FILE *f1, char *file2 + ixnew[j] = ctnew; + j++; + } +- for (; j <= len[1]; j++) ++ for (j = 1; j <= len[1]; j++) + ixnew[j] = ctnew += skipline(f2); + /* + * if (jackpot) +@@ -1551,16 +1575,33 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120614042526.42861106566C>