socsvn commit: r238418 - in soc2012/jhagewood: diff diff/diff diff3
mdocml
jhagewood at FreeBSD.org
jhagewood at FreeBSD.org
Wed Jun 27 21:02:03 UTC 2012
Author: jhagewood
Date: Wed Jun 27 21:02:00 2012
New Revision: 238418
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238418
Log:
Modified:
soc2012/jhagewood/diff/TODO
soc2012/jhagewood/diff/diff-test.sh
soc2012/jhagewood/diff/diff/diff.c
soc2012/jhagewood/diff/diff/diffreg.c
soc2012/jhagewood/diff/hagewood-diff.patch
soc2012/jhagewood/diff3/hagewood-diff3.patch
soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch
Modified: soc2012/jhagewood/diff/TODO
==============================================================================
--- soc2012/jhagewood/diff/TODO Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/diff/TODO Wed Jun 27 21:02:00 2012 (r238418)
@@ -8,17 +8,17 @@
--unidirectional-new-file INCOMPLETE
--normal COMPLETE Sets format to D_NORMAL in getopt_long().
--suppress-common-lines COMPLETE Because side-by-side mode is executed by sdiff, option is simply passed to sdiff.
---GTYPE-group-format INCOMPLETE
+--GTYPE-group-format IN PROGRESS Added options for various GTYPEs.
--line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility
--LTYPE-line-format INCOMPLETE
---from-file COMPLETE Calls exec1() twice with optarg as file input. NEEDS TESTING.
---to-file COMPLETE Calls exec1() twice with optarg as file input. NEEDS TESTING.
+--from-file COMPLETE Calls exec1() twice with optarg as file input. BUG.
+--to-file COMPLETE Calls exec1() twice with optarg as file input. BUG.
--horizon-lines INCOMPLETE
--speed-large-file INCOMPLETE
--ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?)
--width INCOMPLETE
-Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and checks to see if file is ELF format.
-
+Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and detects if file is binary.
+Test script COMPLETE
Notes:
@@ -30,4 +30,34 @@
- With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff.
- The -ignore-*-* options need some work.
+- line formats:
+
+ %l Only includes contents of a line, excluding trailing new line.
+ %L Only includes contents of a line, including trailing new line.
+ %% Stand for '%'
+ %c'C' Where C is a character.
+ %c'\O' where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O.
+ Fn Where n is:
+ -'e'
+ -'f'
+ -'l'
+ -'m'
+ -'n'
+ -'E, F, L, M, N'
+
+- group formats:
+ %< Stands for the lines from the first file, including trailing new lines.
+ %> Stands for the lines from the second file, including trailing new lines.
+ %= Stands for lines common to both files, including trailing new lines.
+ %% Stands for '%'
+ %c'C' Where C is a character.
+ %c'\O' where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O.
+ Fn Where n is:
+ -'e'
+ -'f'
+ -'l'
+ -'m'
+ -'n'
+ -'E, F, L, M, N'
+
Modified: soc2012/jhagewood/diff/diff-test.sh
==============================================================================
--- soc2012/jhagewood/diff/diff-test.sh Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/diff/diff-test.sh Wed Jun 27 21:02:00 2012 (r238418)
@@ -9,83 +9,87 @@
mkdir ./test_outputs/gnu
mkdir ./test_outputs/bsd
-#
-# Run GNU diff with various options, direct output to a file.
-#
-
-# Default diff
-diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt
-
-# --unified output
-diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt
-diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt
-
-# --context output
-diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt
-diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt
-
-# --normal format output
-diff --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt
-diff -c --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt
-diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt
-
-# --brief
-diff -b 1.txt 2.txt >> ./test_outputs/gnu/brief.txt
-diff --brief 1.txt 2.txt >> ./test_outputs/gnu/brief.txt
-
-# --ed
-diff -ed 1.txt 2.txt >> ./test_outputs/gnu/ed.txt
-diff -e 1.txt 2.txt >> ./test_outputs/gnu/ed.txt
-
-# --expand-tabs
-diff --expand-tabs 1.txt 2.txt >> ./test_outputs/gnu/expand-tabs.txt
-diff -t 1.txt 2.txt >> ./test_outputs/gnu/expand-tabs.txt
-
-# --forward-ed
-diff --forward-ed 1.txt 2.txt >> ./test_outputs/gnu/forward-ed.txt
-diff -f 1.txt 2.txt >> ./test_outputs/gnu/forward-ed.txt
-
-# --help
-diff --help 1.txt 2.txt >> ./test_outputs/gnu/help.txt
-
-#
-# Run BSD diff with various options, direct output to a file.
-#
+function run {
-# Default diff
-./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt
+ # Default diff
+ $1 1.txt 2.txt >> $2/diff.txt
-# --unified output
-./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt
-./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt
-
-# --context output
-./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt
-./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt
-
-# --normal format output
-./diff --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt
-./diff -c --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt
-./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt
-
-# --brief
-./diff -b 1.txt 2.txt >> ./test_outputs/bsd/brief.txt
-./diff --brief 1.txt 2.txt >> ./test_outputs/bsd/brief.txt
-
-# --ed
-./diff -ed 1.txt 2.txt >> ./test_outputs/bsd/ed.txt
-./diff -e 1.txt 2.txt >> ./test_outputs/bsd/ed.txt
-
-# --expand-tabs
-./diff --expand-tabs 1.txt 2.txt >> ./test_outputs/bsd/expand-tabs.txt
-./diff -t 1.txt 2.txt >> ./test_outputs/bsd/expand-tabs.txt
-
-# --forward-ed
-./diff --forward-ed 1.txt 2.txt >> ./test_outputs/bsd/foward-ed.txt
-./diff -f 1.txt 2.txt >> ./test_outputs/bsd/forward-ed.txt
+ # --unified output
+ $1 -u 1.txt 2.txt >> $2/unified.txt
+ $1 --unified 1.txt 2.txt >> $2/unified.txt
+ $1 --unified="3" 1.txt 2.txt >> $2/unified.txt
+
+ # --context output
+ $1 -c 1.txt 2.txt >> $2/context.txt
+ $1 --context 1.txt 2.txt >> $2/context.txt
+ $1 --context="3" 1.txt 2.txt >> $2/context.txt
+
+ # --normal format output
+ $1 --normal 1.txt 2.txt >> $2/normal.txt
+ $1 -c --normal 1.txt 2.txt >> $2/normal.txt
+ $1 -u --normal 1.txt 2.txt >> $2/normal.txt
+
+ # --brief
+ $1 -b 1.txt 2.txt >> $2/brief.txt
+ $1 --brief 1.txt 2.txt >> $2/brief.txt
+
+ # --ed
+ $1 -ed 1.txt 2.txt >> $2/ed.txt
+ $1 -e 1.txt 2.txt >> $2/ed.txt
+
+ # --expand-tabs
+ $1 --expand-tabs 1.txt 2.txt >> $2/expand-tabs.txt
+ $1 -t 1.txt 2.txt >> $2/expand-tabs.txt
+
+ # --forward-ed
+ $1 --forward-ed 1.txt 2.txt >> $2/forward-ed.txt
+ $1 -f 1.txt 2.txt >> $2/forward-ed.txt
+
+ # --to-file
+ $1 --tofile="3.txt" 1.txt 2.txt >> $2/tofile.txt
+
+ # --from-file
+ $1 --from-file="3.txt" 1.txt 2.txt >> $2/fromfile.txt
+
+ # --text
+ $1 --text 1.txt 2.txt >> $2/text.txt
+ $1 -a 1.txt 2.txt >> $2/text.txt
+
+ # --strip-trailing-cr
+ $1 --strip-trailing-cr 1.txt 2.txt >> $2 stripcr.txt
+
+ # --rcs
+ $1 --rcs 1.txt 2.txt >> $2/rcs.txt
+ $1 -n 1.txt 2.txt >> $2/rcs.txt
+
+ # --width
+ $1 --width="10" 1.txt 2.txt >> $2/width.txt
+ $1 -W "10" 1.txt 2.txt >> $2/width.txt
+
+ # --side-by-side
+ $1 --side-by-side 1.txt 2.txt >> $2/sbs.txt
+ $1 -y 1.txt 2.txt >> $2/sbs.txt
+
+ # --left-column
+ $1 -y --left-column 1.txt 2.txt >> $2/lc.txt
+ $1 --side-by-side --left-column 1.txt 2.txt >> $2/lc.txt
+
+ # --line-format
+ $1 --line-format="%l %% %c'T'" 1.txt 2.txt >> $2/lf.txt
+
+ #
+
+ # --help
+ $1 --help 1.txt 2.txt >> $2/help.txt
+}
+
+$PATH = './test_outputs/gnu'
+$DIFF_PATH = '/usr/bin/diff'
+run $DIFF_PATH $PATH
+$PATH = './test_outputs/bsd'
+$DIFF_PATH = './diff'
+run $DIFF_PATH $PATH
-# --help
-diff --help 1.txt 2.txt >> ./test_outputs/bsd/help.txt
#
# Get the diff between the GNU and BSD outputs.
#
Modified: soc2012/jhagewood/diff/diff/diff.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 21:02:00 2012 (r238418)
@@ -68,7 +68,10 @@
OPT_NORMAL,
OPT_LEFTC,
OPT_SUPCL,
- OPT_GTYPE,
+ OPT_CHGD_GF,
+ OPT_NEW_GF,
+ OPT_OLD_GF,
+ OPT_UNCHGD_GF,
OPT_LF,
OPT_LLF,
OPT_TSIZE,
@@ -90,6 +93,7 @@
*/
{ "brief", no_argument, NULL, 'q' },
+ { "changed-group-format", required_Argument, NULL, OPT_CHGD_GF},
{ "context", optional_argument, NULL, 'C' },
{ "ed", no_argument, NULL, 'e' },
{ "exclude", required_argument, NULL, 'x' },
@@ -97,7 +101,6 @@
{ "expand-tabs", no_argument, NULL, 't' },
{ "from-file", required_argument, NULL, OPT_FFILE },
{ "forward-ed", no_argument, NULL, 'f' },
- /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/
{ "help", no_argument, NULL, OPT_HELP },
/*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/
{ "ifdef", required_argument, NULL, 'D' },
@@ -112,13 +115,14 @@
{ "label", required_argument, NULL, 'L' },
{ "left-column", no_argument, NULL, OPT_LEFTC },
{ "line-format", required_argument, NULL, OPT_LF },
- /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/
{ "minimal", no_argument, NULL, 'd' },
{ "new-file", no_argument, NULL, 'N' },
{ "new-line-format", required_argument, NULL, OPT_NEW_LF},
+ { "new-group-format", required_argument, NULL, OPT_NEW_GF},
{ "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE },
{ "normal", no_argument, NULL, OPT_NORMAL },
{ "old-line-format", required_argument, NULL, OPT_OLD_LF},
+ { "old-group-format", required_argument, NULL OPT_OLD_GF},
{ "paginate", no_argument, NULL, 'l' },
{ "recursive", no_argument, NULL, 'r' },
{ "report-identical-files", no_argument, NULL, 's' },
@@ -133,6 +137,7 @@
{ "tabsize", optional_argument, NULL, OPT_TSIZE },
{ "text", no_argument, NULL, 'a' },
{ "to-file", required_argument, NULL, OPT_TOFILE },
+ { "unchanged-group-format", required_argument, NULL, OPT_UNCHGD_GF},
{ "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF},
{ "unidirectional-new-file", no_argument, NULL, 'P' },
{ "unified", optional_argument, NULL, 'U' },
@@ -162,7 +167,7 @@
int
main(int argc, char **argv)
{
- char *ep, **oargv, *file1, *file2, *file3;
+ char *ep, **oargv, *args, *file1, *file2, *file3;
long l;
int ch, lastch, gotstdin, prevoptind, newarg;
int oargc, childstat;
@@ -313,6 +318,14 @@
file2 = argv[argc-1];
file3 = optarg;
break;
+ case OPT_CHGD_GF:
+ case OPT_NEW_GF:
+ case OPT_OLD_GF:
+ case OPT_UNCHGD_GF:
+ /* XXX To do: Coplete --GTYPE-group-format. */
+ format = D_IFDEF;
+ ifdefname = optarg;
+ break;
case OPT_NEW_LF:
case OPT_OLD_LF:
case OPT_UNCHGD_LF:
@@ -377,12 +390,18 @@
(void)fprintf(stderr, "--from-file and --to-file both specified.\n");
exit(2);
}
+ while ((ch = getopt(argc, argv, OPTIONS)) != -1)
+ strcat(args, ch);
childpid = fork();
+ if (childpid < 0) {
+ (void)fprintf(stderr, "Error forking process.\n");
+ exit(2);
+ }
if (childpid == 0) {
if (Toflag)
- execl(_PATH_DIFF, _PATH_DIFF, file1, file3);
+ execl(_PATH_DIFF, _PATH_DIFF, args, file1, file3);
if (Fromflag)
- execl(_PATH_DIFF, _PATH_DIFF, file3, file1);
+ execl(_PATH_DIFF, _PATH_DIFF, args, file3, file1);
exit(127);
}
if (childpid > 0) {
Modified: soc2012/jhagewood/diff/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffreg.c Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/diff/diff/diffreg.c Wed Jun 27 21:02:00 2012 (r238418)
@@ -1356,12 +1356,8 @@
if (aflag || f == NULL)
return (1);
rewind(f);
- /* If the first 4 bytes of the file are the same as the first 4 bytes of
- * an ELF file header, return 0.
- */
- fread(buf, 1, sizeof(buf), f);
- if(buf[0] == 0x7F && buf[1] == 0x45 &&
- buf[2] == 0x4C && buf[3] == 0x46)
+ for (i = 0; i <= strlen(buf) || i <= 32; i++)
+ if (memchr(buf, '\0', strlen(buf)) != NULL)
return (0);
return (1);
}
Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 21:02:00 2012 (r238418)
@@ -1,6 +1,6 @@
diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c
---- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400
-+++ jhagewood/diff/diff/diff.c 2012-06-27 04:20:28.000000000 -0400
+--- jhagewood/diff/diff-orig/diff.c 2012-06-25 12:05:52.000000000 -0400
++++ jhagewood/diff/diff/diff.c 2012-06-27 16:35:04.000000000 -0400
@@ -1,4 +1,4 @@
-/*-
+/*
@@ -56,13 +56,17 @@
/* Options which exceed manageable alphanumeric assignments */
-@@ -69,75 +67,77 @@ enum
+@@ -69,75 +67,82 @@ enum
OPT_STRIPCR,
OPT_NORMAL,
OPT_LEFTC,
- OT_SUPCL,
+- OPT_GTYPE,
+ OPT_SUPCL,
- OPT_GTYPE,
++ OPT_CHGD_GF,
++ OPT_NEW_GF,
++ OPT_OLD_GF,
++ OPT_UNCHGD_GF,
OPT_LF,
OPT_LLF,
OPT_TSIZE,
@@ -107,6 +111,7 @@
+ */
+
+ { "brief", no_argument, NULL, 'q' },
++ { "changed-group-format", required_Argument, NULL, OPT_CHGD_GF},
{ "context", optional_argument, NULL, 'C' },
- { "ifdef", required_argument, NULL, 'D' },
- { "minimal", no_argument, NULL, 'd' },
@@ -120,7 +125,6 @@
+ { "expand-tabs", no_argument, NULL, 't' },
+ { "from-file", required_argument, NULL, OPT_FFILE },
{ "forward-ed", no_argument, NULL, 'f' },
-+ /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/
+ { "help", no_argument, NULL, OPT_HELP },
+ /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/
+ { "ifdef", required_argument, NULL, 'D' },
@@ -137,7 +141,6 @@
- { "paginate", no_argument, NULL, 'l' },
+ { "left-column", no_argument, NULL, OPT_LEFTC },
+ { "line-format", required_argument, NULL, OPT_LF },
-+ /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/
+ { "minimal", no_argument, NULL, 'd' },
{ "new-file", no_argument, NULL, 'N' },
- { "rcs", no_argument, NULL, 'n' },
@@ -145,9 +148,11 @@
- { "show-c-function", no_argument, NULL, 'p' },
- { "brief", no_argument, NULL, 'q' },
+ { "new-line-format", required_argument, NULL, OPT_NEW_LF},
++ { "new-group-format", required_argument, NULL, OPT_NEW_GF},
+ { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE },
+ { "normal", no_argument, NULL, OPT_NORMAL },
+ { "old-line-format", required_argument, NULL, OPT_OLD_LF},
++ { "old-group-format", required_argument, NULL OPT_OLD_GF},
+ { "paginate", no_argument, NULL, 'l' },
{ "recursive", no_argument, NULL, 'r' },
- { "starting-file", required_argument, NULL, 'S' },
@@ -166,6 +171,7 @@
+ { "tabsize", optional_argument, NULL, OPT_TSIZE },
+ { "text", no_argument, NULL, 'a' },
+ { "to-file", required_argument, NULL, OPT_TOFILE },
++ { "unchanged-group-format", required_argument, NULL, OPT_UNCHGD_GF},
+ { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF},
+ { "unidirectional-new-file", no_argument, NULL, 'P' },
{ "unified", optional_argument, NULL, 'U' },
@@ -180,7 +186,7 @@
{ NULL, 0, NULL, '\0'}
};
-@@ -162,11 +162,12 @@ void read_excludes_file(char *);
+@@ -162,11 +167,12 @@ void read_excludes_file(char *);
int
main(int argc, char **argv)
{
@@ -189,7 +195,7 @@
- int ch, lastch, gotstdin, prevoptind, newarg;
- int oargc;
-
-+ char *ep, **oargv, *file1, *file2, *file3;
++ char *ep, **oargv, *args, *file1, *file2, *file3;
+ long l;
+ int ch, lastch, gotstdin, prevoptind, newarg;
+ int oargc, childstat;
@@ -198,7 +204,7 @@
oargv = argv;
oargc = argc;
gotstdin = 0;
-@@ -197,6 +198,7 @@ main(int argc, char **argv)
+@@ -197,6 +203,7 @@ main(int argc, char **argv)
break;
case 'C':
case 'c':
@@ -206,7 +212,7 @@
format = D_CONTEXT;
if (optarg != NULL) {
l = strtol(optarg, &ep, 10);
-@@ -213,6 +215,9 @@ main(int argc, char **argv)
+@@ -213,6 +220,9 @@ main(int argc, char **argv)
case 'd':
dflag = 1;
break;
@@ -216,7 +222,7 @@
case 'e':
format = D_EDIT;
break;
-@@ -296,15 +301,44 @@ main(int argc, char **argv)
+@@ -296,15 +306,52 @@ main(int argc, char **argv)
case 'y':
yflag = 1;
break;
@@ -232,6 +238,14 @@
+ file2 = argv[argc-1];
+ file3 = optarg;
+ break;
++ case OPT_CHGD_GF:
++ case OPT_NEW_GF:
++ case OPT_OLD_GF:
++ case OPT_UNCHGD_GF:
++ /* XXX To do: Coplete --GTYPE-group-format. */
++ format = D_IFDEF;
++ ifdefname = optarg;
++ break;
+ case OPT_NEW_LF:
+ case OPT_OLD_LF:
+ case OPT_UNCHGD_LF:
@@ -269,7 +283,7 @@
case OPT_STRIPCR:
strip_cr=1;
break;
-@@ -328,20 +362,51 @@ main(int argc, char **argv)
+@@ -328,20 +375,57 @@ main(int argc, char **argv)
lastch = ch;
newarg = optind != prevoptind;
prevoptind = optind;
@@ -290,12 +304,18 @@
+ (void)fprintf(stderr, "--from-file and --to-file both specified.\n");
+ exit(2);
+ }
++ while ((ch = getopt(argc, argv, OPTIONS)) != -1)
++ strcat(args, ch);
+ childpid = fork();
++ if (childpid < 0) {
++ (void)fprintf(stderr, "Error forking process.\n");
++ exit(2);
++ }
+ if (childpid == 0) {
+ if (Toflag)
-+ execl(_PATH_DIFF, _PATH_DIFF, file1, file3);
++ execl(_PATH_DIFF, _PATH_DIFF, args, file1, file3);
+ if (Fromflag)
-+ execl(_PATH_DIFF, _PATH_DIFF, file3, file1);
++ execl(_PATH_DIFF, _PATH_DIFF, args, file3, file1);
+ exit(127);
+ }
+ if (childpid > 0) {
@@ -326,7 +346,7 @@
execv(_PATH_SDIFF, oargv);
_exit(127);
}
-@@ -380,7 +445,10 @@ main(int argc, char **argv)
+@@ -380,7 +464,10 @@ main(int argc, char **argv)
set_argstr(oargv, argv);
if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) {
if (format == D_IFDEF)
@@ -338,7 +358,7 @@
diffdir(argv[0], argv[1]);
} else {
if (S_ISDIR(stb1.st_mode)) {
-@@ -402,11 +470,10 @@ main(int argc, char **argv)
+@@ -402,11 +489,10 @@ main(int argc, char **argv)
void *
emalloc(size_t n)
{
@@ -351,7 +371,7 @@
if ((p = malloc(n)) == NULL)
errx(2, NULL);
return (p);
-@@ -415,7 +482,7 @@ emalloc(size_t n)
+@@ -415,7 +501,7 @@ emalloc(size_t n)
void *
erealloc(void *p, size_t n)
{
@@ -360,7 +380,7 @@
if (n == 0)
errx(2, NULL);
-@@ -431,13 +498,12 @@ erealloc(void *p, size_t n)
+@@ -431,13 +517,12 @@ erealloc(void *p, size_t n)
int
easprintf(char **ret, const char *fmt, ...)
{
@@ -376,7 +396,7 @@
if (len < 0 || *ret == NULL)
errx(2, NULL);
return (len);
-@@ -446,11 +512,12 @@ easprintf(char **ret, const char *fmt, .
+@@ -446,11 +531,12 @@ easprintf(char **ret, const char *fmt, .
char *
estrdup(const char *str)
{
@@ -391,7 +411,7 @@
strlcpy(cp, str, len);
return (cp);
}
-@@ -531,6 +598,7 @@ push_ignore_pats(char *pattern)
+@@ -531,6 +617,7 @@ push_ignore_pats(char *pattern)
void
print_only(const char *path, size_t dirlen, const char *entry)
{
@@ -399,7 +419,7 @@
if (dirlen > 1)
dirlen--;
printf("Only in %.*s: %s\n", (int)dirlen, path, entry);
-@@ -539,45 +607,46 @@ print_only(const char *path, size_t dirl
+@@ -539,45 +626,46 @@ print_only(const char *path, size_t dirl
void
print_status(int val, char *path1, char *path2, char *entry)
{
@@ -457,7 +477,7 @@
break;
}
}
-@@ -585,6 +654,7 @@ print_status(int val, char *path1, char
+@@ -585,6 +673,7 @@ print_status(int val, char *path1, char
void
usage(void)
{
@@ -465,25 +485,9 @@
(void)fprintf(stderr,
"usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n"
" [-L label] file1 file2\n"
-diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h
---- jhagewood/diff/diff-orig/diff.h 2012-06-25 16:05:53.000000000 -0400
-+++ jhagewood/diff/diff/diff.h 2012-06-26 04:19:55.000000000 -0400
-@@ -75,9 +75,9 @@ struct excludes {
- struct excludes *next;
- };
-
--extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
-- sflag, tflag, Tflag, wflag;
--extern int Bflag, strip_cr, tabsize;
-+extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
-+ sflag, tflag, Tflag, Toflag, wflag;
-+extern int Bflag, strip_cr, suppress_cl, tabsize;
- extern int format, context, status;
- extern char ignore_file_case;
- extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c
---- jhagewood/diff/diff-orig/diffdir.c 2012-06-25 16:05:53.000000000 -0400
-+++ jhagewood/diff/diff/diffdir.c 2012-06-25 16:05:53.000000000 -0400
+--- jhagewood/diff/diff-orig/diffdir.c 2012-06-25 12:05:52.000000000 -0400
++++ jhagewood/diff/diff/diffdir.c 2012-06-25 12:05:52.000000000 -0400
@@ -20,14 +20,13 @@
#include <sys/cdefs.h>
@@ -591,9 +595,25 @@
strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1);
if (stat(path1, &stb1) != 0) {
+diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h
+--- jhagewood/diff/diff-orig/diff.h 2012-06-25 12:05:52.000000000 -0400
++++ jhagewood/diff/diff/diff.h 2012-06-26 00:19:54.000000000 -0400
+@@ -75,9 +75,9 @@ struct excludes {
+ struct excludes *next;
+ };
+
+-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
+- sflag, tflag, Tflag, wflag;
+-extern int Bflag, strip_cr, tabsize;
++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
++ sflag, tflag, Tflag, Toflag, wflag;
++extern int Bflag, strip_cr, suppress_cl, tabsize;
+ extern int format, context, status;
+ extern char ignore_file_case;
+ extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c
---- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 21:19:12.000000000 -0400
-+++ jhagewood/diff/diff/diffreg.c 2012-06-25 21:33:12.000000000 -0400
+--- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 17:19:12.000000000 -0400
++++ jhagewood/diff/diff/diffreg.c 2012-06-27 14:31:58.000000000 -0400
@@ -62,15 +62,13 @@
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93
*/
@@ -657,7 +677,7 @@
anychange = 0;
lastline = 0;
-@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int
+@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int
status |= 2;
goto closem;
}
@@ -665,7 +685,7 @@
switch (files_differ(f1, f2, flags)) {
case 0:
goto closem;
-@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int
+@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int
goto closem;
}
@@ -1098,7 +1118,7 @@
sum = 1;
space = 0;
-@@ -1305,19 +1344,24 @@ readhash(FILE *f)
+@@ -1305,19 +1344,20 @@ readhash(FILE *f)
return (sum == 0 ? 1 : sum);
}
@@ -1121,16 +1141,12 @@
- cnt = fread(buf, 1, sizeof(buf), f);
- for (i = 0; i < cnt; i++)
- if (!isprint(buf[i]) && !isspace(buf[i]))
-+ /* If the first 4 bytes of the file are the same as the first 4 bytes of
-+ * an ELF file header, return 0.
-+ */
-+ fread(buf, 1, sizeof(buf), f);
-+ if(buf[0] == 0x7F && buf[1] == 0x45 &&
-+ buf[2] == 0x4C && buf[3] == 0x46)
++ for (i = 0; i <= strlen(buf) || i <= 32; i++)
++ if (memchr(buf, '\0', strlen(buf)) != NULL)
return (0);
return (1);
}
-@@ -1327,10 +1371,10 @@ asciifile(FILE *f)
+@@ -1327,10 +1367,10 @@ asciifile(FILE *f)
static char *
match_function(const long *f, int pos, FILE *file)
{
@@ -1145,7 +1161,7 @@
lastline = pos;
while (pos > last) {
-@@ -1342,7 +1386,6 @@ match_function(const long *f, int pos, F
+@@ -1342,7 +1382,6 @@ match_function(const long *f, int pos, F
if (nc > 0) {
buf[nc] = '\0';
buf[strcspn(buf, "\n")] = '\0';
@@ -1153,7 +1169,7 @@
if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
if (begins_with(buf, "private:")) {
if (!state)
-@@ -1373,9 +1416,9 @@ static void
+@@ -1373,9 +1412,9 @@ static void
dump_context_vec(FILE *f1, FILE *f2)
{
struct context_vec *cvp = context_vec_start;
@@ -1166,7 +1182,7 @@
if (context_vec_start > context_vec_ptr)
return;
-@@ -1390,8 +1433,8 @@ dump_context_vec(FILE *f1, FILE *f2)
+@@ -1390,8 +1429,8 @@ dump_context_vec(FILE *f1, FILE *f2)
if (pflag) {
f = match_function(ixold, lowa-1, f1);
if (f != NULL) {
@@ -1177,7 +1193,7 @@
}
}
printf("\n*** ");
-@@ -1478,9 +1521,9 @@ static void
+@@ -1478,9 +1517,9 @@ static void
dump_unified_vec(FILE *f1, FILE *f2)
{
struct context_vec *cvp = context_vec_start;
@@ -1190,7 +1206,7 @@
if (context_vec_start > context_vec_ptr)
return;
-@@ -1491,19 +1534,19 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1491,19 +1530,19 @@ dump_unified_vec(FILE *f1, FILE *f2)
lowc = MAX(1, cvp->c - context);
upd = MIN(len[1], context_vec_ptr->d + context);
@@ -1216,7 +1232,7 @@
/*
* Output changes in "unified" diff format--the old and new lines
-@@ -1551,16 +1594,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
+@@ -1551,16 +1590,43 @@ dump_unified_vec(FILE *f1, FILE *f2)
static void
print_header(const char *file1, const char *file2)
{
@@ -1267,8 +1283,8 @@
+ file2, buf2);
}
diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h
---- jhagewood/diff/diff-orig/pathnames.h 2012-06-25 16:05:53.000000000 -0400
-+++ jhagewood/diff/diff/pathnames.h 2012-06-26 04:51:36.000000000 -0400
+--- jhagewood/diff/diff-orig/pathnames.h 2012-06-25 12:05:52.000000000 -0400
++++ jhagewood/diff/diff/pathnames.h 2012-06-26 00:51:36.000000000 -0400
@@ -23,4 +23,5 @@
#include <paths.h>
Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch
==============================================================================
--- soc2012/jhagewood/diff3/hagewood-diff3.patch Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/diff3/hagewood-diff3.patch Wed Jun 27 21:02:00 2012 (r238418)
@@ -1,17 +1,6 @@
-diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile
---- jhagewood/diff3/diff3-orig/Makefile 2012-06-25 16:05:53.000000000 -0400
-+++ jhagewood/diff3/diff3/Makefile 2012-06-25 16:05:53.000000000 -0400
-@@ -6,6 +6,6 @@ BINDIR= /usr/libexec
-
- beforeinstall:
- install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
-- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3
-+ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3
-
- .include <bsd.prog.mk>
diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c
---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-25 16:05:53.000000000 -0400
-+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-25 16:05:53.000000000 -0400
+--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-25 12:05:52.000000000 -0400
++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-25 12:05:52.000000000 -0400
@@ -64,19 +64,23 @@
* @(#)diff3.c 8.1 (Berkeley) 6/6/93
*/
@@ -466,3 +455,14 @@
+ fprintf(stderr, "usage: diff3 %s file1 file2 file3\n", OPTIONS);
exit(EXIT_FAILURE);
}
+diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile
+--- jhagewood/diff3/diff3-orig/Makefile 2012-06-25 12:05:52.000000000 -0400
++++ jhagewood/diff3/diff3/Makefile 2012-06-25 12:05:52.000000000 -0400
+@@ -6,6 +6,6 @@ BINDIR= /usr/libexec
+
+ beforeinstall:
+ install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3
++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3
+
+ .include <bsd.prog.mk>
Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch
==============================================================================
--- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Wed Jun 27 20:34:29 2012 (r238417)
+++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Wed Jun 27 21:02:00 2012 (r238418)
@@ -1,6 +1,6 @@
diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h
---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-25 16:05:56.000000000 -0400
-+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-25 16:05:59.000000000 -0400
+--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-25 12:05:56.000000000 -0400
++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-25 12:05:58.000000000 -0400
@@ -43,6 +43,8 @@ enum mant {
MAN_sp,
MAN_nf,
@@ -12,7 +12,7 @@
MAN_DT,
diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig
--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500
-+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-25 16:05:59.000000000 -0400
++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-25 12:05:58.000000000 -0400
@@ -0,0 +1,113 @@
+/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */
+/*
@@ -128,8 +128,8 @@
+
+#endif /*!MAN_H*/
diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c
---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-25 16:05:56.000000000 -0400
-+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-25 16:05:59.000000000 -0400
+--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-25 12:05:56.000000000 -0400
++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-25 12:05:58.000000000 -0400
@@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS);
static int pre_ft(DECL_ARGS);
static int pre_ign(DECL_ARGS);
@@ -173,7 +173,7 @@
static int
diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig
--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500
-+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-25 16:05:59.000000000 -0400
++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-25 12:05:58.000000000 -0400
@@ -0,0 +1,1117 @@
+/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */
+/*
More information about the svn-soc-all
mailing list