Date: Thu, 24 Jun 2010 02:18:42 GMT From: Benjamin Fiedler <bfiedler@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 180175 for review Message-ID: <201006240218.o5O2IgLd020522@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180175?ac=10 Change 180175 by bfiedler@freebsd-7803 on 2010/06/24 02:17:50 Further testing need on ignore-tab-expansion Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/Makefile#2 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#5 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#5 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/Makefile#2 (text+ko) ==== @@ -1,6 +1,8 @@ # $FreeBSD$ # $OpenBSD: Makefile,v 1.2 2003/06/25 02:42:50 deraadt Exp $ +DEBUG_FLAGS+= -g + PROG= diff SRCS= diff.c diffdir.c diffreg.c CFLAGS+= -std=c99 -Wall -pedantic ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#5 (text+ko) ==== @@ -47,7 +47,7 @@ #include "pathnames.h" int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -int sflag, tflag, Tflag, wflag, uniflag, yflag, strip_cr, tabsize=8; +int sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize=8; int horizon, Eflag; int format, status; int fcase_behave = FCASE_SENSITIVE; @@ -296,7 +296,10 @@ push_excludes(optarg); break; case 'y': - yflag = 1; + oargv[0] = _PATH_SDIFF; + execv(_PATH_SDIFF, oargv); + _exit(127); + break; case FROMFILE_OPT: if (tofile != NULL) @@ -360,19 +363,6 @@ argc -= optind; argv += optind; - if(yflag) { - /* remove y flag from args and call sdiff */ - for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); - while(argv != &oargv[oargc]){ - *argv=*(argv+1); - argv++; - } - oargv[0] = _PATH_SDIFF; - *argv= "\0"; - - execv(_PATH_SDIFF, oargv); - _exit(127); - } /* * Do sanity checks, fill in stb1 and stb2 and call the appropriate ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#5 (text+ko) ==== @@ -694,7 +694,7 @@ static void check(FILE *f1, FILE *f2) { - int i, j, jackpot, a, b, newcol; + int i, j, jackpot, a, b, ccol, dcol; wint_t c, d; long ctold, ctnew; wchar_t *strc, *strd; @@ -706,6 +706,7 @@ ixold[0] = ixnew[0] = 0; jackpot = 0; ctold = ctnew = 0; + ccol = dcol = 0; for (i = 1; i <= len[0]; i++) { if (J[i] == 0) { ixold[i] = ctold += skipline(f1); @@ -718,6 +719,8 @@ strc = fgetwln(f1, &lenc); strd = fgetwln(f2, &lend); + ccol = lenc; + dcol = lend; if (Bflag) { while ((lenc = 1) && (strc[0] == L'\n')) @@ -762,18 +765,38 @@ ctnew++; } } - newcol = ((b/8)+1)*8; - while ((Eflag) && (c == L'\t') && (d == L' ') && b <= newcol ) - d = strd[++b]; + if (Eflag) { + while( ((d == L'\t') && (c == L' ')) || + ( (c == L'\t') && (d == L' ')) ) { + + if(c == L'\t') { + c = strc[++a]; + ccol += (a+ccol) % tabsize; + } + + else if(d == L'\t') { + b = strd[++b]; + dcol += (b+dcol) % tabsize; + } + + while ( (d == L' ') && (b + dcol < a + ccol) && + b < lend ) + { + d = strd[++b]; + } + + while ( (c == L' ') && (a + ccol < b + dcol) && + a < lenc ) + { + c = strc[++a]; + } - newcol = ((a/8)+1)*8; - while ((Eflag) && (d == L'\t') && (c == L' ') && a <= newcol ) - c = strc[++a]; + if ((a + ccol) != (b + dcol) ) { + break; + } + } + } - if (Eflag && d == L'\t') - d = strd[++b]; - if (Eflag && c == L'\t') - c = strc[++a]; if (c != d) { @@ -1189,11 +1212,15 @@ for (i = 0; (t = getwc(f)) != L'\n'; i++) { if (t == L'\r' && strip_cr) continue; - if (t == L'\t' && Eflag) - newcol = ((i/8)+1)*8; + if (t == L'\t' && Eflag) { + newcol = ((i/tabsize)+1)*tabsize; do { sum = sum * 127 + (int) L' '; } while (++i < newcol); + + if( (t = getwc(f)) == L'\n') + break; + } if (t == EOF) { if (i == 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006240218.o5O2IgLd020522>