Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jun 2012 21:52:07 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r238024 - in soc2012/jhagewood/diff: . diff
Message-ID:  <20120620215207.33B471065672@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Wed Jun 20 21:52:05 2012
New Revision: 238024
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238024

Log:

Modified:
  soc2012/jhagewood/diff/diff/diff.c
  soc2012/jhagewood/diff/diff/diffdir.c
  soc2012/jhagewood/diff/hagewood-diff.patch

Modified: soc2012/jhagewood/diff/diff/diff.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diff.c	Wed Jun 20 20:01:51 2012	(r238023)
+++ soc2012/jhagewood/diff/diff/diff.c	Wed Jun 20 21:52:05 2012	(r238024)
@@ -81,57 +81,57 @@
 
 
 static struct option longopts[] = {
+	
+	/*
+	 * Commented-out options are unimplemented.
+	 */
 
-	{ "normal",			no_argument,		NULL,	OPT_NORMAL },
-	{ "line-format",		required_argument,	NULL,	OPT_LF },
-	{ "suppress-common-lines",	no_argument,		NULL,	OPT_SUPCL },
-/* XXX: UNIMPLEMENTED
- 	{ "left-column",		no_argument,		NULL,	OPT_LEFTC },
-	{ "GTYPE-group-format",		required_argument,	NULL,	OPT_GTYPE },
-	{ "LTYPE-line-format",		required_argument,	NULL,	OPT_LLF },
-	{ "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' },
+	{ "brief",			no_argument,		NULL,	'q' },
 	{ "context",			optional_argument,	NULL,	'C' },
-	{ "ifdef",			required_argument,	NULL,	'D' },
-	{ "minimal",			no_argument,		NULL,	'd' },
-	{ "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' },
+	/*{ "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' },
+	{ "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 },
+	/*{ "LTYPE-line-format",		required_argument,	NULL,	OPT_LLF },*/
+	{ "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' },
+	{ "no-ignore-file-name-case",	no_argument,		NULL,	OPT_NIGN_FN_CASE },
+	{ "normal",			no_argument,		NULL,	OPT_NORMAL },
+	{ "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' },
+	{ "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 },*/
+	{ "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'}
 };
 

Modified: soc2012/jhagewood/diff/diff/diffdir.c
==============================================================================
--- soc2012/jhagewood/diff/diff/diffdir.c	Wed Jun 20 20:01:51 2012	(r238023)
+++ soc2012/jhagewood/diff/diff/diffdir.c	Wed Jun 20 21:52:05 2012	(r238024)
@@ -168,17 +168,16 @@
 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);
@@ -190,19 +189,17 @@
 		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) {

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Wed Jun 20 20:01:51 2012	(r238023)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Wed Jun 20 21:52:05 2012	(r238024)
@@ -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-18 03:07:38.000000000 -0400
-+++ jhagewood/diff/diff/diff.c	2012-06-19 06:04:34.000000000 -0400
++++ jhagewood/diff/diff/diff.c	2012-06-20 21:51:36.000000000 -0400
 @@ -18,15 +18,13 @@
   * Materiel Command, USAF, under agreement number F39502-99-1-0512.
   */
@@ -57,48 +57,108 @@
    OPT_FFILE,
    OPT_TOFILE,
    OPT_HLINES,
-@@ -84,14 +81,14 @@ enum 
+@@ -84,60 +81,57 @@ enum 
  
  
  static struct option longopts[] = {
 -/* XXX: UNIMPLEMENTED
-+
- 	{ "normal",			no_argument,		NULL,	OPT_NORMAL },
+-	{ "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 },
-+	{ "suppress-common-lines",	no_argument,		NULL,	OPT_SUPCL },
-+/* XXX: UNIMPLEMENTED
-+ 	{ "left-column",		no_argument,		NULL,	OPT_LEFTC },
-+	{ "GTYPE-group-format",		required_argument,	NULL,	OPT_GTYPE },
- 	{ "LTYPE-line-format",		required_argument,	NULL,	OPT_LLF },
+-	{ "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 },
-@@ -105,12 +102,10 @@ static struct option longopts[] = {
- /* XXX: UNIMPLEMENTED */
- 	{ "ignore-blank-lines",		no_argument,		NULL,	'B' }, 
- 	{ "ignore-space-change",	no_argument,		NULL,	'b' },
+-	{ "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' },
  	{ "context",			optional_argument,	NULL,	'C' },
- 	{ "ifdef",			required_argument,	NULL,	'D' },
- 	{ "minimal",			no_argument,		NULL,	'd' },
+-	{ "ifdef",			required_argument,	NULL,	'D' },
+-	{ "minimal",			no_argument,		NULL,	'd' },
 -/* XXX: UNIMPLEMENTED
 -	{ "ignore-tab-expansion",	no_argument,		NULL,	'E' }, */
-+	{ "ignore-tab-expansion",	no_argument,		NULL,	'E' }, 
  	{ "ed",				no_argument,		NULL,	'e' },
- /* XXX: UNIMPLEMENTED
- 	{ "show-function-line",		required_argument,	NULL,	'F' }, */
-@@ -129,7 +124,6 @@ static struct option longopts[] = {
+-/* 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' },
++	/*{ "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' },
++	{ "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 },
++	/*{ "LTYPE-line-format",		required_argument,	NULL,	OPT_LLF },*/
++	{ "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' },
++	{ "no-ignore-file-name-case",	no_argument,		NULL,	OPT_NIGN_FN_CASE },
++	{ "normal",			no_argument,		NULL,	OPT_NORMAL },
++	{ "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' },
+-	{ "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 },*/
++	{ "unidirectional-new-file",	no_argument,		NULL,	'P' },
  	{ "unified",			optional_argument,	NULL,	'U' },
  	{ "version",			no_argument,		NULL,	'v' },
- /* XXX: UNIMPLEMENTED
+-/* 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'}
+ };
+ 
 @@ -162,10 +156,10 @@ void read_excludes_file(char *);
  int
  main(int argc, char **argv)
@@ -307,7 +367,7 @@
  extern int	 format, context, status;
 diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c
 --- jhagewood/diff/diff-orig/diffdir.c	2012-06-18 03:07:38.000000000 -0400
-+++ jhagewood/diff/diff/diffdir.c	2012-06-20 05:19:37.000000000 -0400
++++ jhagewood/diff/diff/diffdir.c	2012-06-20 05:43:28.000000000 -0400
 @@ -20,14 +20,13 @@
  
  #include <sys/cdefs.h>
@@ -346,7 +406,56 @@
  
  	dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1));
  	if (dirlen1 >= sizeof(path1) - 1) {
-@@ -255,8 +254,8 @@ slurpdir(char *path, char **bufp, int en
+@@ -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)
  {
@@ -357,7 +466,7 @@
  
  	return (strcmp(dp1->d_name, dp2->d_name));
  }
-@@ -267,7 +266,7 @@ dircompare(const void *vp1, const void *
+@@ -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)
  {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120620215207.33B471065672>