Date: Sat, 07 Jul 2012 19:50:04 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r239093 - in soc2012/jhagewood: diff diff3 mdocml sdiff sdiff/sdiff Message-ID: <20120707195004.CEFE1106564A@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhagewood Date: Sat Jul 7 19:50:04 2012 New Revision: 239093 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239093 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch soc2012/jhagewood/sdiff/hagewood-sdiff.patch soc2012/jhagewood/sdiff/sdiff/sdiff.c Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sat Jul 7 19:34:52 2012 (r239092) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sat Jul 7 19:50:04 2012 (r239093) @@ -1,1589 +1,6 @@ -diff -rupN jhagewood/diff/diff-orig/.svn/all-wcprops jhagewood/diff/diff/.svn/all-wcprops ---- jhagewood/diff/diff-orig/.svn/all-wcprops 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/all-wcprops 2012-07-07 14:53:51.000000000 -0400 -@@ -1,59 +1,59 @@ - K 25 - svn:wc:ra_dav:version-url --V 56 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig -+V 51 -+/socsvn/!svn/ver/239048/soc2012/jhagewood/diff/diff - END - diff.1.gz - K 25 - svn:wc:ra_dav:version-url --V 66 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.1.gz -+V 61 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.1.gz - END - pathnames.h - K 25 - svn:wc:ra_dav:version-url --V 68 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/pathnames.h -+V 63 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/pathnames.h - END - diff.1 - K 25 - svn:wc:ra_dav:version-url --V 63 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.1 -+V 58 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.1 - END - diffreg.c - K 25 - svn:wc:ra_dav:version-url --V 66 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diffreg.c -+V 61 -+/socsvn/!svn/ver/239048/soc2012/jhagewood/diff/diff/diffreg.c - END - diff - K 25 - svn:wc:ra_dav:version-url --V 61 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff -+V 56 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff - END - diffdir.c - K 25 - svn:wc:ra_dav:version-url --V 66 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diffdir.c -+V 61 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diffdir.c - END - diff.c - K 25 - svn:wc:ra_dav:version-url --V 63 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.c -+V 58 -+/socsvn/!svn/ver/239007/soc2012/jhagewood/diff/diff/diff.c - END - Makefile - K 25 - svn:wc:ra_dav:version-url --V 65 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/Makefile -+V 60 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/Makefile - END - diff.h - K 25 - svn:wc:ra_dav:version-url --V 63 --/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff-orig/diff.h -+V 58 -+/socsvn/!svn/ver/238807/soc2012/jhagewood/diff/diff/diff.h - END -diff -rupN jhagewood/diff/diff-orig/.svn/entries jhagewood/diff/diff/.svn/entries ---- jhagewood/diff/diff-orig/.svn/entries 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/entries 2012-07-07 14:53:51.000000000 -0400 -@@ -2,13 +2,13 @@ - - dir - 239088 --https://socsvn.freebsd.org/socsvn/soc2012/jhagewood/diff/diff-orig -+https://socsvn.freebsd.org/socsvn/soc2012/jhagewood/diff/diff - https://socsvn.freebsd.org/socsvn - - - --2012-07-02T14:59:21.494992Z --238807 -+2012-07-06T17:31:27.428691Z -+239048 - jhagewood - - -@@ -67,7 +67,7 @@ file - - - 2012-07-07T18:53:51.000000Z --5a0333c769b4cd0b56d0183979c3c3da -+02e0e4002578433745dc1989cde68db3 - 2012-07-02T14:59:21.494992Z - 238807 - jhagewood -@@ -92,7 +92,7 @@ jhagewood - - - --1173 -+1208 - - diff.1 - file -@@ -135,9 +135,9 @@ file - - - 2012-07-07T18:53:51.000000Z --41390d52e706fd5ff89e5139b1a3992a --2012-07-02T14:59:21.494992Z --238807 -+360e792dce77ba35267246e878158613 -+2012-07-06T17:31:27.428691Z -+239048 - jhagewood - - -@@ -160,7 +160,7 @@ jhagewood - - - --38935 -+40791 - - diff - file -@@ -203,7 +203,7 @@ file - - - 2012-07-07T18:53:51.000000Z --28bd85291f636c13f457cda2ec9e2168 -+44a983d6f3f06103b3210dc9799dc9aa - 2012-07-02T14:59:21.494992Z - 238807 - jhagewood -@@ -228,7 +228,7 @@ jhagewood - - - --8385 -+8360 - - diff.c - file -@@ -237,9 +237,9 @@ file - - - 2012-07-07T18:53:51.000000Z --5c74db6e58594c5d345aa050fcda44ae --2012-07-02T14:59:21.494992Z --238807 -+060bb447cdcbd060f328603bc0595a90 -+2012-07-05T18:13:06.636166Z -+239007 - jhagewood - - -@@ -262,7 +262,7 @@ jhagewood - - - --14455 -+18176 - - Makefile - file -@@ -305,7 +305,7 @@ file - - - 2012-07-07T18:53:51.000000Z --eab9e28aee9d963655a25372ef2f2657 -+f389a5742640cda8b39f75a4cda31197 - 2012-07-02T14:59:21.494992Z - 238807 - jhagewood -@@ -330,5 +330,5 @@ jhagewood - - - --3738 -+3852 - -diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diff.c.svn-base jhagewood/diff/diff/.svn/text-base/diff.c.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diff.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diff.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -1,4 +1,4 @@ --/*- -+/* - * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> - * - * Permission to use, copy, modify, and distribute this software for any -@@ -18,15 +18,13 @@ - * Materiel Command, USAF, under agreement number F39502-99-1-0512. - */ - --#include <sys/cdefs.h> -- --#ifndef lint - #if 0 --__RCSID("$OpenBSD: diff.c,v 1.50 2007/05/29 18:24:56 ray Exp $"); --#else --__FBSDID("$FreeBSD$"); -+#ifndef lint -+static char sccsid[] = "@(#)diff.c 8.1 (Berkeley) 6/6/93"; - #endif - #endif /* not lint */ -+#include <sys/cdefs.h> -+__FBSDID("$FreeBSD$"); - - #include <sys/param.h> - #include <sys/stat.h> -@@ -45,20 +43,20 @@ __FBSDID("$FreeBSD$"); - #include "diff.h" - #include "pathnames.h" - --int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; --int sflag, tflag, Tflag, wflag; --int Bflag, yflag; --int strip_cr, tabsize=8; --char ignore_file_case = 0; --int format, context, status; --char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; -+int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -+int sflag, tflag, Tflag, wflag, Toflag, Fromflag; -+int Bflag, yflag; -+int strip_cr, suppress_cl, tabsize = 8; -+char ignore_file_case = 0; -+int format, context, status; -+char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format; - struct stat stb1, stb2; - struct excludes *excludes_list; - regex_t ignore_re; - - int flag_opts = 0; - --#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" -+#define OPTIONS "0123456789aBbC:cdD:EefhI:iL:lnNPpqrS:sTtU:uvwXy:x" - - - /* Options which exceed manageable alphanumeric assignments */ -@@ -69,84 +67,129 @@ enum - OPT_STRIPCR, - OPT_NORMAL, - OPT_LEFTC, -- OT_SUPCL, -- OPT_GTYPE, -+ OPT_SUPCL, -+ OPT_CHGD_GF, -+ OPT_NEW_GF, -+ OPT_OLD_GF, -+ OPT_UNCHGD_GF, - OPT_LF, - OPT_LLF, - OPT_TSIZE, -- OPT_UNINF, - OPT_FFILE, - OPT_TOFILE, - OPT_HLINES, - OPT_LFILES, - OPT_HELP, -+ OPT_NEW_LF, -+ OPT_OLD_LF, -+ OPT_UNCHGD_LF, - }; - - - static struct option longopts[] = { --/* XXX: UNIMPLEMENTED -- { "normal", no_argument, NULL, OPT_NORMAL }, -- { "left-column", no_argument, NULL, OPT_LEFTC }, -- { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, -- { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, -- { "line-format", required_argument, NULL, OPT_LF }, -- { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, -- { "unidirectional-new-file", no_argument, NULL, OPT_UNINF }, -- { "from-file", required_argument, NULL, OPT_FFILE }, -- { "to-file", required_argument, NULL, OPT_TOFILE }, -- { "horizon-lines", required_argument, NULL, OPT_HLINES }, -- { "speed-large-files", no_argument, NULL, OPT_LFILES }, */ -- { "tabsize", optional_argument, NULL, OPT_TSIZE }, -- { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, -- { "help", no_argument, NULL, OPT_HELP }, -- { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, -- { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, -- { "text", no_argument, NULL, 'a' }, --/* XXX: UNIMPLEMENTED */ -- { "ignore-blank-lines", no_argument, NULL, 'B' }, -- { "ignore-space-change", no_argument, NULL, 'b' }, --/* XXX: -c is incompatible with GNU version */ -+ -+ /* -+ * Commented-out options are unimplemented. -+ */ -+ -+ { "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' }, --/* XXX: UNIMPLEMENTED -- { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ - { "ed", no_argument, NULL, 'e' }, --/* XXX: UNIMPLEMENTED -- { "show-function-line", required_argument, NULL, 'F' }, */ -+ { "exclude", required_argument, NULL, 'x' }, -+ { "exclude-from", required_argument, NULL, 'X' }, -+ { "expand-tabs", no_argument, NULL, 't' }, -+ { "from-file", required_argument, NULL, OPT_FFILE }, - { "forward-ed", no_argument, NULL, 'f' }, -+ { "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-blank-lines", no_argument, NULL, 'B' }, -+ { "ignore-case", no_argument, NULL, 'i' }, -+ { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, - { "ignore-matching-lines", required_argument, NULL, 'I' }, -- { "ignore-case", no_argument, NULL, 'i' }, -+ { "ignore-space-change", no_argument, NULL, 'b' }, -+ { "ignore-tab-expansion", no_argument, NULL, 'E' }, -+ { "initial-tab", no_argument, NULL, 'T' }, - { "label", required_argument, NULL, 'L' }, -- { "paginate", no_argument, NULL, 'l' }, -+ { "left-column", no_argument, NULL, OPT_LEFTC }, -+ { "line-format", required_argument, NULL, OPT_LF }, -+ { "minimal", no_argument, NULL, 'd' }, - { "new-file", no_argument, NULL, 'N' }, -- { "rcs", no_argument, NULL, 'n' }, -- { "unidirectional-new-file", no_argument, NULL, 'P' }, -- { "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' }, - { "report-identical-files", no_argument, NULL, 's' }, -- { "initial-tab", no_argument, NULL, 'T' }, -- { "expand-tabs", no_argument, NULL, 't' }, --/* XXX: -u is incompatible with GNU version */ -+ { "rcs", no_argument, NULL, 'n' }, -+ { "show-c-function", no_argument, NULL, 'p' }, -+ { "show-function-line", required_argument, NULL, 'F' }, -+ { "side-by-side", no_argument, NULL, 'y' }, -+ /*{ "speed-large-files", no_argument, NULL, OPT_LFILES }, */ -+ { "starting-file", required_argument, NULL, 'S' }, -+ { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, -+ { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, -+ { "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' }, - { "version", no_argument, NULL, 'v' }, --/* XXX: UNIMPLEMENTED -- { "width", optional_argument, NULL, 'W' }, */ -- { "ignore-all-space", no_argument, NULL, 'w' }, -- { "exclude-from", required_argument, NULL, 'X' }, -- { "exclude", required_argument, NULL, 'x' }, -- { "side-by-side", no_argument, NULL, 'y' }, -+ /*{ "width", optional_argument, NULL, 'w' }, */ - { NULL, 0, NULL, '\0'} - }; - - static const char *help_msg[] = { --"-a --text treat files as ASCII text", --"-B --ignore-blank-lines Ignore blank newlines in the comparison", --"-b --ignore-space-change Ignore all changes due to whitespace", --"-C NUM --context=[NUM] Show NUM lines before and after change (default 3)", --"-D --ifdef=NAME", -+"\t-a --text treat files as ASCII text", -+"\t-B --ignore-blank-lines Ignore blank newlines in the comparison", -+"\t-b --ignore-space-change Ignore all changes due to whitespace", -+"\t-C -c NUM --context=NUM Show NUM lines before and after change (default 3)", -+"\t-D --ifdef=NAME Output merged file with `#ifdef NAME' diffs", -+"\t-E --ignore-tab-expansion Ignore tab expansion in the comparison", -+"\t-e --ed Output an ed script", -+"\t-F --show-function-line=RE Show the most recent line matching RE", -+"\t-f --forward-ed Output a forward ed script", -+"\t-I --ignore-matching-lines=RE Ignore changes whose lines all match RE", -+"\t-i --ignore-case Ignore case differences in file contents", -+"\t-L --label=NAME Label file header", -+"\t-l --paginate Paginates output through pr", -+"\t-N --new-file Treat new files as empty", -+"\t-n --rcs Output an RCS format diff", -+"\t-P --unidirectional-new-file Treat absent-first files as empty", -+"\t-p --show-c-function Show which C function each change is in", -+"\t-q --brief report only when files differ", -+"\t-r --recursive Recursively compare any sub-directories found", -+"\t-S --starting-file=FILE Start with FILE when comparing directories", -+"\t-s --report-identical-files Report when two files are the same", -+"\t-T --initial-tab Make tabs line up by prepending a tab", -+"\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", -+"\t-y --side-by-side Output difference in two columns", -+"\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", -+"\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", -+"\t--from-file=FILE Compare FILE to all operands", -+"\t--to-file=FILE Compare all operands to FILE", -+"\t--ignore-file-name-case Ignore file name case", -+"\t--left-column Output the only the left column of common lines", -+"\t--line-format=LFMT Format all input lines with LFMT", -+"\t--no-ignore-file-name-case Do not ignore file name case", -+"\t--normal Output a normal diff (default output)", -+"\t--strip-trailing-cr Strip trailing carriage return", -+"\t--suppress-common-lines Do not output common lines", -+"\t--tabsize=NUM Tab stops every NUM (default 8) print columns", -+"\t--help Output this help message", - NULL, - }; - char **help_strs = (char **)help_msg; -@@ -162,14 +205,15 @@ void read_excludes_file(char *); - int - main(int argc, char **argv) - { -- char *ep, **oargv; -- long l; -- int ch, lastch, gotstdin, prevoptind, newarg; -- int oargc; -- -+ char *ep, **oargv, *optfile; -+ long l; -+ int ch, lastch, gotstdin, prevoptind, newarg; -+ int oargc; -+ - oargv = argv; - oargc = argc; - gotstdin = 0; -+ optfile = "\0"; - - lastch = '\0'; - prevoptind = 1; -@@ -197,6 +241,7 @@ main(int argc, char **argv) - break; - case 'C': - case 'c': -+ cflag = 1; - format = D_CONTEXT; - if (optarg != NULL) { - l = strtol(optarg, &ep, 10); -@@ -213,6 +258,9 @@ main(int argc, char **argv) - case 'd': - dflag = 1; - break; -+ case 'E': -+ Eflag = 1; -+ break; - case 'e': - format = D_EDIT; - break; -@@ -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; -+ case OPT_FFILE: -+ Toflag = 1; -+ optfile = optarg; -+ break; -+ case OPT_TOFILE: -+ Fromflag = 1; -+ optfile = optarg; -+ break; -+ case OPT_CHGD_GF: -+ case OPT_NEW_GF: -+ case OPT_OLD_GF: -+ case OPT_UNCHGD_GF: -+ /* XXX To do: Complete --GTYPE-group-format. */ -+ format = D_GF; -+ group_format = optarg; -+ break; -+ case OPT_NEW_LF: -+ case OPT_OLD_LF: -+ case OPT_UNCHGD_LF: -+ case OPT_LF: -+ /* XXX To do: Complete --line-format. */ -+ format = D_LF; -+ line_format = optarg; -+ break; -+ case OPT_NORMAL: -+ format = D_NORMAL; -+ break; -+ case OPT_LEFTC: -+ /* Do nothing, passes option to sdiff. */ -+ break; -+ case OPT_SUPCL: -+ /* Do nothing, passes option to sdiff. */ -+ break; - case OPT_TSIZE: -- if (optarg != NULL) { -- l = strtol(optarg, &ep, 10); -- if (*ep != '\0' || l < 1 || l >= INT_MAX) -- usage(); -- tabsize = (int)l; -- } else -- tabsize = 8; -- break; -+ if (optarg != NULL) { -+ l = strtol(optarg, &ep, 10); -+ if (*ep != '\0' || l < 1 || l >= INT_MAX) -+ usage(); -+ tabsize = (int)l; -+ } else -+ tabsize = 8; -+ break; - 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; - prevoptind = optind; -+ - } - argc -= optind; - argv += optind; -- -- if(yflag) { -+ if (yflag) { - /* remove y flag from args and call sdiff */ -- for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); -+ for (argv = oargv; argv && strcmp(*argv, "-y") != 0 && -+ strcmp(*argv, "--side-by-side") != 0; argv++); - while(argv != &oargv[oargc]){ -- *argv=*(argv+1); -+ *argv= *(argv+1); - argv++; - } - oargv[0] = _PATH_SDIFF; - *argv= "\0"; -- - execv(_PATH_SDIFF, oargv); - _exit(127); - } -@@ -380,7 +460,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) -- errx(2, "-D option not supported with directories"); -+ if (ch == 'D') -+ errx(2, "-D option not supported with directories"); -+ if (ch == OPT_LF) -+ errx(2, "--line-format option not supported with directories"); - diffdir(argv[0], argv[1]); - } else { - if (S_ISDIR(stb1.st_mode)) { -@@ -393,8 +476,26 @@ main(int argc, char **argv) - if (stat(argv[1], &stb2) < 0) - err(2, "%s", argv[1]); - } -- print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], -- NULL); -+ /* Checks if --to-file or --from-file are specified */ -+ if (Toflag && Fromflag) { -+ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); -+ exit(2); -+ } -+ if (Toflag) { -+ print_status(diffreg(optfile, argv[0], 0), optfile, argv[0], -+ NULL); -+ print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], -+ NULL); -+ } -+ if (Fromflag) { -+ print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, -+ NULL); -+ print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, -+ NULL); -+ } -+ if (!Toflag && !Fromflag) -+ print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], -+ NULL); - } - exit(status); - } -@@ -402,11 +503,10 @@ main(int argc, char **argv) - void * - emalloc(size_t n) - { -- void *p; -+ void *p; - - if (n == 0) - errx(2, NULL); -- - if ((p = malloc(n)) == NULL) - errx(2, NULL); - return (p); -@@ -415,7 +515,7 @@ emalloc(size_t n) - void * - erealloc(void *p, size_t n) - { -- void *q; -+ void *q; - - if (n == 0) - errx(2, NULL); -@@ -431,13 +531,12 @@ erealloc(void *p, size_t n) - int - easprintf(char **ret, const char *fmt, ...) - { -- int len; -- va_list ap; -+ int len; -+ va_list ap; - - va_start(ap, fmt); - len = vasprintf(ret, fmt, ap); - va_end(ap); -- - if (len < 0 || *ret == NULL) - errx(2, NULL); - return (len); -@@ -446,11 +545,12 @@ easprintf(char **ret, const char *fmt, . - char * - estrdup(const char *str) - { -- size_t len; -- char *cp; -+ size_t len; -+ char *cp; - - len = strlen(str) + 1; - cp = emalloc(len); -+ - strlcpy(cp, str, len); - return (cp); - } -@@ -531,6 +631,7 @@ push_ignore_pats(char *pattern) - void - print_only(const char *path, size_t dirlen, const char *entry) - { -+ - if (dirlen > 1) - dirlen--; - printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +640,46 @@ print_only(const char *path, size_t dirl - void - print_status(int val, char *path1, char *path2, char *entry) - { -+ - switch (val) { - case D_ONLY: - print_only(path1, strlen(path1), entry); - break; - case D_COMMON: - printf("Common subdirectories: %s%s and %s%s\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_BINARY: -- printf("Binary files %s%s and %s%s differ\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ printf("Files %s%s and %s%s differ\n", -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_DIFFER: - if (format == D_BRIEF) - printf("Files %s%s and %s%s differ\n", -- path1, entry ? entry : "", -- path2, entry ? entry : ""); -+ path1, entry ? entry : "", -+ path2, entry ? entry : ""); - break; - case D_SAME: - if (sflag) - printf("Files %s%s and %s%s are identical\n", -- path1, entry ? entry : "", -- path2, entry ? entry : ""); -+ path1, entry ? entry : "", -+ path2, entry ? entry : ""); - break; - case D_MISMATCH1: - printf("File %s%s is a directory while file %s%s is a regular file\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_MISMATCH2: - printf("File %s%s is a regular file while file %s%s is a directory\n", -- path1, entry ? entry : "", path2, entry ? entry : ""); -+ path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_SKIPPED1: - printf("File %s%s is not a regular file or directory and was skipped\n", -- path1, entry ? entry : ""); -+ path1, entry ? entry : ""); - break; - case D_SKIPPED2: - printf("File %s%s is not a regular file or directory and was skipped\n", -- path2, entry ? entry : ""); -+ path2, entry ? entry : ""); - break; - } - } -@@ -585,6 +687,7 @@ print_status(int val, char *path1, char - void - usage(void) - { -+ - (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/.svn/text-base/diff.h.svn-base jhagewood/diff/diff/.svn/text-base/diff.h.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diff.h.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diff.h.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -48,6 +48,8 @@ - #define D_NREVERSE 5 /* Reverse ed script with numbered - lines and no trailing . */ - #define D_BRIEF 6 /* Say if the files differ */ -+#define D_GF 7 /* Group format */ -+#define D_LF 8 /* Line format */ - - /* - * Output flags -@@ -75,9 +77,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/.svn/text-base/diffdir.c.svn-base jhagewood/diff/diff/.svn/text-base/diffdir.c.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diffdir.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diffdir.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -20,14 +20,13 @@ - - #include <sys/cdefs.h> - --#ifndef lint - #if 0 --__RCSID("$OpenBSD: diffdir.c,v 1.32 2007/06/09 05:16:21 ray Exp $"); --#else --__FBSDID("$FreeBSD$"); -+#ifndef lint -+static char sccsid[] = "@(#)diffdir.c 8.1 (Berkeley) 6/6/93"; - #endif - #endif /* not lint */ -- -+#include <sys/cdefs.h> -+__FBSDID("$FreeBSD$"); - #include <sys/param.h> - #include <sys/stat.h> - -@@ -57,12 +56,12 @@ static void diffit(struct dirent *, char - void - diffdir(char *p1, char *p2) - { -- struct dirent **dirp1, **dirp2, **dp1, **dp2; -- struct dirent *dent1, *dent2; -- size_t dirlen1, dirlen2; -- char path1[MAXPATHLEN], path2[MAXPATHLEN]; -- char *dirbuf1, *dirbuf2; -- int pos; -+ struct dirent **dirp1, **dirp2, **dp1, **dp2; -+ struct dirent *dent1, *dent2; -+ size_t dirlen1, dirlen2; -+ char path1[MAXPATHLEN], path2[MAXPATHLEN]; -+ char *dirbuf1, *dirbuf2; -+ int pos; - - dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); - if (dirlen1 >= sizeof(path1) - 1) { -@@ -169,17 +168,16 @@ diffdir(char *p1, char *p2) - static struct dirent ** - slurpdir(char *path, char **bufp, int enoentok) - { -- char *buf, *ebuf, *cp; -- size_t bufsize, have, need; -- long base; -- int fd, nbytes, entries; -- struct stat sb; -- struct dirent **dirlist, *dp; -+ char *buf, *ebuf, *cp; -+ size_t bufsize, have, need; -+ long base; -+ int fd, nbytes, entries; -+ struct stat sb; -+ struct dirent **dirlist, *dp; - - *bufp = NULL; - if ((fd = open(path, O_RDONLY, 0644)) == -1) { - static struct dirent *dummy; -- - if (!enoentok || errno != ENOENT) { - warn("%s", path); - return (NULL); -@@ -191,19 +189,17 @@ slurpdir(char *path, char **bufp, int en - close(fd); - return (NULL); - } -- - need = roundup(sb.st_blksize, sizeof(struct dirent)); - have = bufsize = roundup(MAX(sb.st_size, sb.st_blksize), - sizeof(struct dirent)) + need; - ebuf = buf = emalloc(bufsize); -- - do { - if (have < need) { -- bufsize += need; -- have += need; -- cp = erealloc(buf, bufsize); -- ebuf = cp + (ebuf - buf); -- buf = cp; -+ bufsize += need; -+ have += need; -+ cp = erealloc(buf, bufsize); -+ ebuf = cp + (ebuf - buf); -+ buf = cp; - } - nbytes = getdirentries(fd, ebuf, have, &base); - if (nbytes == -1) { -@@ -255,8 +251,8 @@ slurpdir(char *path, char **bufp, int en - static int - dircompare(const void *vp1, const void *vp2) - { -- struct dirent *dp1 = *((struct dirent **) vp1); -- struct dirent *dp2 = *((struct dirent **) vp2); -+ struct dirent *dp1 = *((struct dirent **) vp1); -+ struct dirent *dp2 = *((struct dirent **) vp2); - - return (strcmp(dp1->d_name, dp2->d_name)); - } -@@ -267,7 +263,7 @@ dircompare(const void *vp1, const void * - static void - diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2) - { -- int flags = D_HEADER; -+ int flags = D_HEADER; - - strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); - if (stat(path1, &stb1) != 0) { -diff -rupN jhagewood/diff/diff-orig/.svn/text-base/diffreg.c.svn-base jhagewood/diff/diff/.svn/text-base/diffreg.c.svn-base ---- jhagewood/diff/diff-orig/.svn/text-base/diffreg.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -+++ jhagewood/diff/diff/.svn/text-base/diffreg.c.svn-base 2012-07-07 14:53:51.000000000 -0400 -@@ -62,15 +62,13 @@ - * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 - */ - --#include <sys/cdefs.h> -- --#ifndef lint - #if 0 --__RCSID("$OpenBSD: diffreg.c,v 1.70 2007/09/11 15:47:17 gilles Exp $"); --#else --__FBSDID("$FreeBSD"); -+#ifndef lint -+static char sccsid[] = "@(#)diffreg.c 8.1 (Berkeley) 6/6/93"; - #endif - #endif /* not lint */ -+#include <sys/cdefs.h> -+__FBSDID("$FreeBSD$"); - - #include <sys/param.h> - #include <sys/stat.h> -@@ -90,6 +88,14 @@ __FBSDID("$FreeBSD"); - #include "diff.h" - #include "pathnames.h" - -+#ifdef ST_MTIM_NSEC -+# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC) -+#else -+# define TIMESPEC_NS(timespec) 0 -+#endif -+ -+#define MAX_CHECK 768 -+ - /* - * diff - compare two files. - */ -@@ -196,7 +202,7 @@ static void change(char *, FILE *, char - static void sort(struct line *, int); - static void print_header(const char *, const char *); - static int ignoreline(char *); --static int asciifile(FILE *); -+static int istextfile(FILE *); - static int fetch(long *, int, int, FILE *, int, int); - static int newcand(int, int, int); - static int search(int *, int, int); -@@ -294,13 +300,13 @@ u_char cup2low[256] = { - int - diffreg(char *ofile1, char *ofile2, int flags) - { -- char *file1 = ofile1; -- char *file2 = ofile2; -- FILE *f1 = NULL; -- FILE *f2 = NULL; -- int rval = D_SAME; -- int i, ostdout = -1; -- pid_t pid = -1; -+ char *file1 = ofile1; -+ char *file2 = ofile2; -+ FILE *f1 = NULL; -+ FILE *f2 = NULL; -+ int rval = D_SAME; -+ int i, ostdout = -1; -+ pid_t pid = -1; - - anychange = 0; - lastline = 0; -@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int - status |= 2; - goto closem; - } -- - switch (files_differ(f1, f2, flags)) { - case 0: - goto closem; -@@ -365,7 +370,7 @@ diffreg(char *ofile1, char *ofile2, int - goto closem; - } - -- if (!asciifile(f1) || !asciifile(f2)) { -+ if (!istextfile(f1) || !istextfile(f2)) { - rval = D_BINARY; - status |= 1; - goto closem; -@@ -477,8 +482,8 @@ closem: - static int - files_differ(FILE *f1, FILE *f2, int flags) - { -- char buf1[BUFSIZ], buf2[BUFSIZ]; -- size_t i, j; -+ char buf1[BUFSIZ], buf2[BUFSIZ]; -+ size_t i, j; - - if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size || - (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) -@@ -503,9 +508,9 @@ files_differ(FILE *f1, FILE *f2, int fla - static FILE * - opentemp(const char *file) - { -- char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN]; -- ssize_t nread; -- int ifd, ofd; -+ char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN]; -+ ssize_t nread; -+ int ifd, ofd; - - if (strcmp(file, "-") == 0) - ifd = STDIN_FILENO; -@@ -541,7 +546,7 @@ opentemp(const char *file) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120707195004.CEFE1106564A>