socsvn commit: r239007 - in soc2012/jhagewood: diff diff/diff sdiff
sdiff/sdiff
jhagewood at FreeBSD.org
jhagewood at FreeBSD.org
Thu Jul 5 18:13:09 UTC 2012
Author: jhagewood
Date: Thu Jul 5 18:13:06 2012
New Revision: 239007
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239007
Log:
Modified:
soc2012/jhagewood/diff/diff/diff.c
soc2012/jhagewood/diff/hagewood-diff.patch
soc2012/jhagewood/sdiff/TODO
soc2012/jhagewood/sdiff/hagewood-sdiff.patch
soc2012/jhagewood/sdiff/sdiff/sdiff.c
Modified: soc2012/jhagewood/diff/diff/diff.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diff.c Thu Jul 5 17:02:20 2012 (r239006)
+++ soc2012/jhagewood/diff/diff/diff.c Thu Jul 5 18:13:06 2012 (r239007)
@@ -104,7 +104,7 @@
{ "help", no_argument, NULL, OPT_HELP },
/*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/
{ "ifdef", required_argument, NULL, 'D' },
- { "ignore-all-space", no_argument, NULL, 'w' },
+ { "ignore-all-space", no_argument, NULL, 'W' },
{ "ignore-blank-lines", no_argument, NULL, 'B' },
{ "ignore-case", no_argument, NULL, 'i' },
{ "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE },
@@ -142,7 +142,7 @@
{ "unidirectional-new-file", no_argument, NULL, 'P' },
{ "unified", optional_argument, NULL, 'U' },
{ "version", no_argument, NULL, 'v' },
- /*{ "width", optional_argument, NULL, 'W' }, */
+ /*{ "width", optional_argument, NULL, 'w' }, */
{ NULL, 0, NULL, '\0'}
};
@@ -172,6 +172,7 @@
"\t-t --expand-tabs Expand tabs to spaces in output",
"\t-U -u NUM --unified=NUM Show NUM lines of unified context",
"\t-v --version Show diff version",
+"\t-W --ignore-all-space Ignore all space",
"\t-w --width=NUM Output at most NUM (default 130) print columns",
"\t-X --exclude-from=FILE Start with FILE when comparing directories",
"\t-x --exclude=PAT Exclude files that match PAT",
@@ -331,7 +332,7 @@
case 'v':
printf("FreeBSD diff 2.8.7\n");
exit(0);
- case 'w':
+ case 'W':
wflag = 1;
break;
case 'X':
@@ -395,11 +396,10 @@
ignore_file_case = 0;
break;
case OPT_HELP:
- for(;*help_strs;help_strs++)
- {
+ for (; *help_strs; help_strs++) {
printf("%s\n", *help_strs);
}
- exit(2);
+ exit(0);
break;
default:
usage();
Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jul 5 17:02:20 2012 (r239006)
+++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jul 5 18:13:06 2012 (r239007)
@@ -1,6 +1,6 @@
diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c
--- jhagewood/diff/diff-orig/diff.c 2012-07-02 15:05:57.000000000 -0400
-+++ jhagewood/diff/diff/diff.c 2012-07-03 15:59:52.000000000 -0400
++++ jhagewood/diff/diff/diff.c 2012-07-05 18:11:07.000000000 -0400
@@ -1,4 +1,4 @@
-/*-
+/*
@@ -56,7 +56,7 @@
/* Options which exceed manageable alphanumeric assignments */
-@@ -69,84 +67,128 @@ enum
+@@ -69,84 +67,129 @@ enum
OPT_STRIPCR,
OPT_NORMAL,
OPT_LEFTC,
@@ -128,7 +128,7 @@
+ { "help", no_argument, NULL, OPT_HELP },
+ /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/
+ { "ifdef", required_argument, NULL, 'D' },
-+ { "ignore-all-space", no_argument, NULL, 'w' },
++ { "ignore-all-space", no_argument, NULL, 'W' },
+ { "ignore-blank-lines", no_argument, NULL, 'B' },
+ { "ignore-case", no_argument, NULL, 'i' },
+ { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE },
@@ -182,7 +182,7 @@
- { "exclude-from", required_argument, NULL, 'X' },
- { "exclude", required_argument, NULL, 'x' },
- { "side-by-side", no_argument, NULL, 'y' },
-+ /*{ "width", optional_argument, NULL, 'W' }, */
++ /*{ "width", optional_argument, NULL, 'w' }, */
{ NULL, 0, NULL, '\0'}
};
@@ -217,6 +217,7 @@
+"\t-t --expand-tabs Expand tabs to spaces in output",
+"\t-U -u NUM --unified=NUM Show NUM lines of unified context",
+"\t-v --version Show diff version",
++"\t-W --ignore-all-space Ignore all space",
+"\t-w --width=NUM Output at most NUM (default 130) print columns",
+"\t-X --exclude-from=FILE Start with FILE when comparing directories",
+"\t-x --exclude=PAT Exclude files that match PAT",
@@ -237,7 +238,7 @@
NULL,
};
char **help_strs = (char **)help_msg;
-@@ -162,14 +204,15 @@ void read_excludes_file(char *);
+@@ -162,14 +205,15 @@ void read_excludes_file(char *);
int
main(int argc, char **argv)
{
@@ -258,7 +259,7 @@
lastch = '\0';
prevoptind = 1;
-@@ -197,6 +240,7 @@ main(int argc, char **argv)
+@@ -197,6 +241,7 @@ main(int argc, char **argv)
break;
case 'C':
case 'c':
@@ -266,7 +267,7 @@
format = D_CONTEXT;
if (optarg != NULL) {
l = strtol(optarg, &ep, 10);
-@@ -213,6 +257,9 @@ main(int argc, char **argv)
+@@ -213,6 +258,9 @@ main(int argc, char **argv)
case 'd':
dflag = 1;
break;
@@ -276,7 +277,16 @@
case 'e':
format = D_EDIT;
break;
-@@ -296,15 +343,48 @@ main(int argc, char **argv)
+@@ -284,7 +332,7 @@ main(int argc, char **argv)
+ case 'v':
+ printf("FreeBSD diff 2.8.7\n");
+ exit(0);
+- case 'w':
++ case 'W':
+ wflag = 1;
+ break;
+ case 'X':
+@@ -296,15 +344,48 @@ main(int argc, char **argv)
case 'y':
yflag = 1;
break;
@@ -333,6 +343,20 @@
case OPT_STRIPCR:
strip_cr=1;
break;
+@@ -315,11 +396,10 @@ main(int argc, char **argv)
+ ignore_file_case = 0;
+ break;
+ case OPT_HELP:
+- for(;*help_strs;help_strs++)
+- {
++ for (; *help_strs; help_strs++) {
+ printf("%s\n", *help_strs);
+ }
+- exit(2);
++ exit(0);
+ break;
+ default:
+ usage();
@@ -328,20 +408,20 @@ main(int argc, char **argv)
lastch = ch;
newarg = optind != prevoptind;
Modified: soc2012/jhagewood/sdiff/TODO
==============================================================================
--- soc2012/jhagewood/sdiff/TODO Thu Jul 5 17:02:20 2012 (r239006)
+++ soc2012/jhagewood/sdiff/TODO Thu Jul 5 18:13:06 2012 (r239007)
@@ -2,7 +2,9 @@
Test script COMPLETE
Adapt code to FreeBSD style guidelines INCOMPLETE
Fix --width output indention IN PROGRESS
-
+--help COMPLETE
+Adapt source to FreBSD style(9) INCOMPLETE
+Add more information to man file. INCOMPLETE
NOTES:
Modified: soc2012/jhagewood/sdiff/hagewood-sdiff.patch
==============================================================================
--- soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 17:02:20 2012 (r239006)
+++ soc2012/jhagewood/sdiff/hagewood-sdiff.patch Thu Jul 5 18:13:06 2012 (r239007)
@@ -1,6 +1,6 @@
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-03 17:10:59.000000000 -0400
++++ jhagewood/sdiff/sdiff/sdiff.c 2012-07-05 18:12:04.000000000 -0400
@@ -34,7 +34,7 @@
#include "common.h"
#include "extern.h"
@@ -20,7 +20,54 @@
/* pid from the diff parent (if applicable) */
DIFF_PID,
-@@ -363,7 +364,7 @@ main(int argc, char **argv)
+@@ -137,6 +138,24 @@ static struct option longopts[] = {
+
+ { NULL, 0, NULL, '\0'}
+ };
++
++static const char *help_msg[] = {
++ "-l, --left-column, Only print the left column for identical lines.",
++ "-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.",
++ "-s, --suppress-common-lines, Skip identical lines.",
++ "-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.",
++ "Options passed to diff(1) are:",
++ "\t-a, --text, Treat file1 and file2 as text files.",
++ "\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.",
++ "\t-d, --minimal, Minimize diff size.",
++ "\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.",
++ "\t-i, --ignore-case, Do a case-insensitive comparison.",
++ "\t-t, --expand-tabs Expand tabs to spaces.",
++ "\t-W, --ignore-all-spaces, Ignore all spaces.",
++ NULL,
++};
++char **help_strs = (char **)help_msg;
++
+ /*
+ * Create temporary file if source_file is not a regular file.
+ * Returns temporary file name if one was malloced, NULL if unnecessary.
+@@ -289,17 +308,17 @@ main(int argc, char **argv)
+ if (errstr)
+ errx(2, "width is %s: %s", errstr, optarg);
+ break;
+-
+ case DIFF_PID:
+ ppid = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "diff pid value is %s: %s", errstr, optarg);
+ break;
+-
+ case HELP_OPT:
+- usage();
++ for (; *help_strs; help_strs++) {
++ printf("%s\n", *help_strs);
++ }
++ exit(0);
+ break;
+-
+ default:
+ usage();
+ break;
+@@ -363,7 +382,7 @@ main(int argc, char **argv)
diffargv[diffargc++] = NULL;
/* Subtract column divider and divide by two. */
@@ -29,7 +76,7 @@
/* Make sure line_width can fit in size_t. */
if (width > (SIZE_MAX - 3) / 2)
errx(2, "width is too large: %zu", width);
-@@ -383,7 +384,6 @@ main(int argc, char **argv)
+@@ -383,7 +402,6 @@ main(int argc, char **argv)
err(2, "child could not duplicate descriptor");
/* Free unused descriptor. */
close(fd[1]);
@@ -37,3 +84,16 @@
execvp(diffprog, diffargv);
err(2, "could not execute diff: %s", diffprog);
break;
+@@ -1117,10 +1135,8 @@ int_usage(void)
+ static void
+ usage(void)
+ {
+- extern char *__progname;
+-
++
+ fprintf(stderr,
+- "usage: %s [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n",
+- __progname);
++ "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n");
+ exit(2);
+ }
Modified: soc2012/jhagewood/sdiff/sdiff/sdiff.c
==============================================================================
--- soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 17:02:20 2012 (r239006)
+++ soc2012/jhagewood/sdiff/sdiff/sdiff.c Thu Jul 5 18:13:06 2012 (r239007)
@@ -138,6 +138,24 @@
{ NULL, 0, NULL, '\0'}
};
+
+static const char *help_msg[] = {
+ "-l, --left-column, Only print the left column for identical lines.",
+ "-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.",
+ "-s, --suppress-common-lines, Skip identical lines.",
+ "-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.",
+ "Options passed to diff(1) are:",
+ "\t-a, --text, Treat file1 and file2 as text files.",
+ "\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.",
+ "\t-d, --minimal, Minimize diff size.",
+ "\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.",
+ "\t-i, --ignore-case, Do a case-insensitive comparison.",
+ "\t-t, --expand-tabs Expand tabs to spaces.",
+ "\t-W, --ignore-all-spaces, Ignore all spaces.",
+ NULL,
+};
+char **help_strs = (char **)help_msg;
+
/*
* Create temporary file if source_file is not a regular file.
* Returns temporary file name if one was malloced, NULL if unnecessary.
@@ -290,17 +308,17 @@
if (errstr)
errx(2, "width is %s: %s", errstr, optarg);
break;
-
case DIFF_PID:
ppid = strtonum(optarg, 0, INT_MAX, &errstr);
if (errstr)
errx(2, "diff pid value is %s: %s", errstr, optarg);
break;
-
case HELP_OPT:
- usage();
+ for (; *help_strs; help_strs++) {
+ printf("%s\n", *help_strs);
+ }
+ exit(0);
break;
-
default:
usage();
break;
@@ -1117,10 +1135,8 @@
static void
usage(void)
{
- extern char *__progname;
-
+
fprintf(stderr,
- "usage: %s [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n",
- __progname);
+ "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n");
exit(2);
}
More information about the svn-soc-all
mailing list