From owner-svn-soc-all@FreeBSD.ORG Mon Jul 2 16:10:05 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 BC9C5106566C for ; Mon, 2 Jul 2012 16:10:03 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 02 Jul 2012 16:10:03 +0000 Date: Mon, 02 Jul 2012 16:10:03 +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: <20120702161003.BC9C5106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238814 - in soc2012/jhagewood/sdiff: . sdiff 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: Mon, 02 Jul 2012 16:10:05 -0000 Author: jhagewood Date: Mon Jul 2 16:10:03 2012 New Revision: 238814 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238814 Log: Modified: soc2012/jhagewood/sdiff/TODO soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff-test.sh soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/sdiff/TODO ============================================================================== --- soc2012/jhagewood/sdiff/TODO Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/TODO Mon Jul 2 16:10:03 2012 (r238814) @@ -1,2 +1,10 @@ Combine diff-spec args and pipe to diff INCOMPLETE Test script COMPLETE +Adapt code to FreeBSD style guidelines INCOMPLETE + +NOTES: + +- BUG: Right side of output is 2 spaces further than GNU sdiff's output. + -FIX: In println(), change column width to width-1, take out + extra space when it prints 'div' on no right column. + Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch ============================================================================== --- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Mon Jul 2 16:10:03 2012 (r238814) @@ -0,0 +1,44 @@ +diff -rupN jhagewood/sdiff/sdiff-orig/sdiff.c jhagewood/sdiff/sdiff/sdiff.c +--- jhagewood/sdiff/sdiff-orig/sdiff.c 2012-07-02 15:05:58.000000000 -0400 ++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-02 16:08:17.000000000 -0400 +@@ -101,7 +101,8 @@ enum { + HLINES_OPT, + LFILES_OPT, + DIFFPROG_OPT, +- ++ PIPE_FD, ++ + /* pid from the diff parent (if applicable) */ + DIFF_PID, + +@@ -474,7 +475,7 @@ printcol(const char *s, size_t *col, con + return; + + /* Round to next multiple of eight. */ +- new_col = (*col / 8 + 1) * 8; ++ new_col = (*col / 8 +1) * 8; + + /* + * If printing the tab goes past the column +@@ -604,7 +605,7 @@ println(const char *s1, const char div, + } + + /* Otherwise, we pad this column up to width. */ +- for (; col < width; ++col) ++ for (; col < width-1; ++col) + putchar(' '); + + /* +@@ -612,10 +613,10 @@ println(const char *s1, const char div, + * need to add the space for padding. + */ + if (!s2) { +- printf(" %c\n", div); ++ printf("%c\n", div); + return; + } +- printf(" %c ", div); ++ printf("%c ", div); + col += 3; + + /* Skip angle bracket and space. */ Modified: soc2012/jhagewood/sdiff/sdiff-test.sh ============================================================================== --- soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/sdiff-test.sh Mon Jul 2 16:10:03 2012 (r238814) @@ -66,11 +66,11 @@ $1 --speed-large-files 1.txt 2.txt >> $2/speedlrgfiles.txt # --diff-program - $1 --diff-program="usr/bin/diff" 1.txt 2.txt >> $2/diffprog.txt + $1 --diff-program="/usr/bin/diff" 1.txt 2.txt >> $2/diffprog.txt # --output - $1 -o $2/output.txt 1.txt 2.txt - $1 --output=$2/output.txt 1.txt 2.txt + $1 -o $2/output.txt 1.txt 2.txt >> /dev/null + $1 --output=$2/output.txt 1.txt 2.txt >> /dev/null # --ignore-matching-lines $1 -I "test" 1.txt 2.txt >> $2/ignrmatchinglines.txt Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c ============================================================================== --- soc2012/jhagewood/sdiff/sdiff/sdiff.c Mon Jul 2 15:28:50 2012 (r238813) +++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Mon Jul 2 16:10:03 2012 (r238814) @@ -101,7 +101,8 @@ HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, - + PIPE_FD, + /* pid from the diff parent (if applicable) */ DIFF_PID, @@ -474,7 +475,7 @@ return; /* Round to next multiple of eight. */ - new_col = (*col / 8 + 1) * 8; + new_col = (*col / 8 +1) * 8; /* * If printing the tab goes past the column @@ -604,7 +605,7 @@ } /* Otherwise, we pad this column up to width. */ - for (; col < width; ++col) + for (; col < width-1; ++col) putchar(' '); /* @@ -612,10 +613,10 @@ * need to add the space for padding. */ if (!s2) { - printf(" %c\n", div); + printf("%c\n", div); return; } - printf(" %c ", div); + printf("%c ", div); col += 3; /* Skip angle bracket and space. */