From owner-svn-soc-all@FreeBSD.ORG Sat Jun 9 05:11:00 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 07154106566C for ; Sat, 9 Jun 2012 05:10:58 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 09 Jun 2012 05:10:58 +0000 Date: Sat, 09 Jun 2012 05:10:58 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120609051058.07154106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237337 - in soc2012/jhagewood/diff3: . diff3 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 05:11:00 -0000 Author: jhagewood Date: Sat Jun 9 05:10:57 2012 New Revision: 237337 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237337 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 04:18:15 2012 (r237336) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 05:10:57 2012 (r237337) @@ -390,8 +390,7 @@ d2 = d23; j = 0; - if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) - { + if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) { printf("Binary file detected; comparison failed\n"); exit(EXIT_FAILURE); } @@ -489,24 +488,24 @@ static int asciifile(FILE *f) { - wint_t ch = L'\0'; - size_t i; + wint_t ch = L'\0'; + size_t i; - if (aflag || f == NULL) - return (1); + if (aflag || f == NULL) + return (1); - rewind(f); - errno = 0; - for (i = 0; i <= BUFSIZ; i++) { - if ((ch = fgetwc(f)) == WEOF) { - if (errno == EILSEQ) - return (0); - break; - } - if (!iswspace(ch) && iswcntrl(ch)) - return (0); - } - return (1); + rewind(f); + errno = 0; + for (i = 0; i <= BUFSIZ; i++) { + if ((ch = fgetwc(f)) == WEOF) { + if (errno == EILSEQ) + return (0); + break; + } + if (!iswspace(ch) && iswcntrl(ch)) + return (0); + } + return (1); } void @@ -533,7 +532,10 @@ (void)skip(i, rold->to, " "); } -/* print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 */ +/* + * print the range of line numbers, rold.from thru rold.to, as n1,n2 or + * n1. + */ void prange(struct range *rold) { @@ -629,8 +631,8 @@ /* If file has trailing carriage return, remove it. */ void -remove_cr(FILE *f) { - +remove_cr(FILE *f) +{ char ch; fpos_t position; fpos_t tcr_pos; @@ -765,7 +767,6 @@ __dead void usage(void) { - fprintf(stderr, "usage: diff3 [-exEX3] /tmp/d3a.?????????? " "/tmp/d3b.?????????? file1 file2 file3\n"); exit(EXIT_FAILURE); Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 04:18:15 2012 (r237336) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 05:10:57 2012 (r237337) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-07 05:12:54.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 04:18:03.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 05:08:37.000000000 -0400 @@ -64,24 +64,34 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -138,25 +138,77 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -510,9 +533,7 @@ change(int i, struct range *rold, int du +@@ -367,8 +390,7 @@ merge(int m1, int m2) + d2 = d23; + j = 0; + +- if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) +- { ++ if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) { + printf("Binary file detected; comparison failed\n"); + exit(EXIT_FAILURE); + } +@@ -466,24 +488,24 @@ merge(int m1, int m2) + static int + asciifile(FILE *f) + { +- wint_t ch = L'\0'; +- size_t i; ++ wint_t ch = L'\0'; ++ size_t i; + +- if (aflag || f == NULL) +- return (1); ++ if (aflag || f == NULL) ++ return (1); + +- rewind(f); +- errno = 0; +- for (i = 0; i <= BUFSIZ; i++) { +- if ((ch = fgetwc(f)) == WEOF) { +- if (errno == EILSEQ) +- return (0); +- break; +- } +- if (!iswspace(ch) && iswcntrl(ch)) +- return (0); +- } +- return (1); ++ rewind(f); ++ errno = 0; ++ for (i = 0; i <= BUFSIZ; i++) { ++ if ((ch = fgetwc(f)) == WEOF) { ++ if (errno == EILSEQ) ++ return (0); ++ break; ++ } ++ if (!iswspace(ch) && iswcntrl(ch)) ++ return (0); ++ } ++ return (1); + } + + void +@@ -510,8 +532,9 @@ change(int i, struct range *rold, int du (void)skip(i, rold->to, " "); } -/* - * print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 -- */ -+/* print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 */ ++/* ++ * print the range of line numbers, rold.from thru rold.to, as n1,n2 or ++ * n1. + */ void prange(struct range *rold) - { -@@ -606,6 +627,30 @@ repos(int nchar) +@@ -606,6 +629,30 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } +/* If file has trailing carriage return, remove it. */ +void -+remove_cr(FILE *f) { -+ ++remove_cr(FILE *f) ++{ + char ch; + fpos_t position; + fpos_t tcr_pos; @@ -180,7 +232,7 @@ __dead void trouble(void) { -@@ -698,13 +743,30 @@ increase(void) +@@ -698,13 +745,29 @@ increase(void) szchanges = newsz; } @@ -207,7 +259,7 @@ usage(void) { - extern char *__progname; - +- - fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " - "/tmp/d3b.?????????? file1 file2 file3\n", __progname); + fprintf(stderr, "usage: diff3 [-exEX3] /tmp/d3a.?????????? "