Date: Tue, 19 Jun 2012 04:59:54 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r237923 - in soc2012/jhagewood/diff: . diff Message-ID: <20120619045954.7910D106566B@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhagewood Date: Tue Jun 19 04:59:53 2012 New Revision: 237923 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237923 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 04:44:24 2012 (r237922) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 19 04:59:53 2012 (r237923) @@ -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> @@ -159,10 +157,10 @@ int main(int argc, char **argv) { - char *ep, **oargv; - long l; - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; + char *ep, **oargv; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; oargv = argv; oargc = argc; @@ -410,7 +408,7 @@ void * emalloc(size_t n) { - void *p; + void *p; if (n == 0) errx(2, NULL); @@ -423,7 +421,7 @@ void * erealloc(void *p, size_t n) { - void *q; + void *q; if (n == 0) errx(2, NULL); @@ -439,8 +437,8 @@ 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); @@ -454,8 +452,8 @@ char * estrdup(const char *str) { - size_t len; - char *cp; + size_t len; + char *cp; len = strlen(str) + 1; cp = emalloc(len); @@ -547,52 +545,54 @@ 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 : ""); - break; - case D_BINARY: - printf("Files %s%s and %s%s differ\n", - path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_DIFFER: - if (format == D_BRIEF) + 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 : ""); + break; + case D_BINARY: printf("Files %s%s and %s%s differ\n", - 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 : ""); - 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 : ""); - 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 : ""); - break; - case D_SKIPPED1: - printf("File %s%s is not a regular file or directory and was skipped\n", - 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 : ""); - break; + 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 : ""); + break; + case D_SAME: + if (sflag) + printf("Files %s%s and %s%s are identical\n", + 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 : ""); + 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 : ""); + break; + case D_SKIPPED1: + printf("File %s%s is not a regular file or directory and was skipped\n", + 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 : ""); + break; } } void usage(void) { + (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:44:24 2012 (r237922) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 19 04:59:53 2012 (r237923) @@ -1,7 +1,27 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-18 03:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-19 00:37:42.000000000 -0400 -@@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); ++++ jhagewood/diff/diff/diff.c 2012-06-19 04:59:23.000000000 -0400 +@@ -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,10 +43,10 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "pathnames.h" @@ -14,7 +34,7 @@ char ignore_file_case = 0; int format, context, status; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; -@@ -58,7 +58,7 @@ regex_t ignore_re; +@@ -58,7 +56,7 @@ regex_t ignore_re; int flag_opts = 0; @@ -23,7 +43,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -74,7 +74,6 @@ enum +@@ -74,7 +72,6 @@ enum OPT_LF, OPT_LLF, OPT_TSIZE, @@ -31,7 +51,7 @@ OPT_FFILE, OPT_TOFILE, OPT_HLINES, -@@ -84,14 +83,14 @@ enum +@@ -84,14 +81,14 @@ enum static struct option longopts[] = { @@ -50,7 +70,7 @@ { "from-file", required_argument, NULL, OPT_FFILE }, { "to-file", required_argument, NULL, OPT_TOFILE }, { "horizon-lines", required_argument, NULL, OPT_HLINES }, -@@ -109,8 +108,7 @@ static struct option longopts[] = { +@@ -109,8 +106,7 @@ static struct option longopts[] = { { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, { "minimal", no_argument, NULL, 'd' }, @@ -60,7 +80,7 @@ { "ed", no_argument, NULL, 'e' }, /* XXX: UNIMPLEMENTED { "show-function-line", required_argument, NULL, 'F' }, */ -@@ -129,7 +127,6 @@ static struct option longopts[] = { +@@ -129,7 +125,6 @@ static struct option longopts[] = { { "report-identical-files", no_argument, NULL, 's' }, { "initial-tab", no_argument, NULL, 'T' }, { "expand-tabs", no_argument, NULL, 't' }, @@ -68,7 +88,22 @@ { "unified", optional_argument, NULL, 'U' }, { "version", no_argument, NULL, 'v' }, /* XXX: UNIMPLEMENTED -@@ -197,6 +194,7 @@ main(int argc, char **argv) +@@ -162,10 +157,10 @@ 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; ++ long l; ++ int ch, lastch, gotstdin, prevoptind, newarg; ++ int oargc; + + oargv = argv; + oargc = argc; +@@ -197,6 +192,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -76,7 +111,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +211,9 @@ main(int argc, char **argv) +@@ -213,6 +209,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -86,7 +121,7 @@ case 'e': format = D_EDIT; break; -@@ -296,6 +297,13 @@ main(int argc, char **argv) +@@ -296,6 +295,13 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -100,15 +135,139 @@ case OPT_TSIZE: if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -548,7 +556,7 @@ print_status(int val, char *path1, char - path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_BINARY: +@@ -402,7 +408,7 @@ main(int argc, char **argv) + void * + emalloc(size_t n) + { +- void *p; ++ void *p; + + if (n == 0) + errx(2, NULL); +@@ -415,7 +421,7 @@ emalloc(size_t n) + void * + erealloc(void *p, size_t n) + { +- void *q; ++ void *q; + + if (n == 0) + errx(2, NULL); +@@ -431,8 +437,8 @@ 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); +@@ -446,8 +452,8 @@ 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); +@@ -539,52 +545,54 @@ 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 : ""); +- break; +- case D_BINARY: - printf("Binary files %s%s and %s%s differ\n", -+ printf("Files %s%s and %s%s differ\n", - path1, entry ? entry : "", path2, entry ? entry : ""); - break; - case D_DIFFER: +- path1, entry ? entry : "", path2, entry ? entry : ""); +- break; +- case D_DIFFER: +- if (format == D_BRIEF) ++ 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 : ""); ++ break; ++ case D_BINARY: + printf("Files %s%s and %s%s differ\n", +- 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 : ""); +- 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 : ""); +- 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 : ""); +- break; +- case D_SKIPPED1: +- printf("File %s%s is not a regular file or directory and was skipped\n", +- 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 : ""); +- break; ++ 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 : ""); ++ break; ++ case D_SAME: ++ if (sflag) ++ printf("Files %s%s and %s%s are identical\n", ++ 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 : ""); ++ 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 : ""); ++ break; ++ case D_SKIPPED1: ++ printf("File %s%s is not a regular file or directory and was skipped\n", ++ 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 : ""); ++ break; + } + } + + 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/diff.h jhagewood/diff/diff/diff.h --- jhagewood/diff/diff-orig/diff.h 2012-06-18 03:07:38.000000000 -0400 +++ jhagewood/diff/diff/diff.h 2012-06-18 03:07:38.000000000 -0400
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120619045954.7910D106566B>