socsvn commit: r238814 - in soc2012/jhagewood/sdiff: . sdiff
jhagewood at FreeBSD.org
jhagewood at FreeBSD.org
Mon Jul 2 16:10:05 UTC 2012
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. */
More information about the svn-soc-all
mailing list