socsvn commit: r238366 - in soc2012/jhagewood/diff: . diff

jhagewood at FreeBSD.org jhagewood at FreeBSD.org
Wed Jun 27 03:16:39 UTC 2012


Author: jhagewood
Date: Wed Jun 27 03:16:36 2012
New Revision: 238366
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238366

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	Wed Jun 27 01:44:48 2012	(r238365)
+++ soc2012/jhagewood/diff/diff/diff.c	Wed Jun 27 03:16:36 2012	(r238366)
@@ -162,7 +162,7 @@
 int
 main(int argc, char **argv)
 {
-	char *ep, **oargv, *args, *cmpfile1, *cmpfile2;
+	char *ep, **oargv, *file1, *file2, *file3;
 	long l;
 	int ch, lastch, gotstdin, prevoptind, newarg;
 	int oargc;
@@ -170,7 +170,6 @@
 	oargv = argv;
 	oargc = argc;
 	gotstdin = 0;
-	args = "-";
 
 	lastch = '\0';
 	prevoptind = 1;
@@ -303,8 +302,14 @@
 			break;
 		case OPT_FFILE:
 			Toflag = 1;
+			file1 = argv[argc-2];
+			file2 = argv[argc-1];
+			file3 = optarg;
 			break;
 		case OPT_TOFILE:
+			file1 = argv[argc-2];
+			file2 = argv[argc-1];
+			file3 = optarg;
 			Fromflag = 1;
 			break;
 		case OPT_NEW_LF:
@@ -357,33 +362,24 @@
 		newarg = optind != prevoptind;
 		prevoptind = optind;
 		
-		/* For use when executing to-file and from-file options. */
-		if (ch != OPT_FFILE && ch != OPT_TOFILE) {
-			strcat(args, ch);
-		}
 	}
 	argc -= optind;
 	argv += optind;
 	
+	/* XXX to do- pass arguements */
 	if (Toflag || Fromflag) {
 		if (Toflag && Fromflag) {
 			(void)fprintf(stderr, "--from-file and --to-file both specified.\n");
 			exit(2);
 		}
 		if (Toflag) {
-			if (execl(_PATH_DIFF, args, argv[argc-2], optarg) ||
-				execl(_PATH_DIFF, args, argv[argc-1], optarg)) {
-				(void)fprintf(stderr, "--to-file error.\n");
-				exit(2);				
-			}
+			execl(_PATH_DIFF, _PATH_DIFF, file1, file3);
+			execl(_PATH_DIFF, _PATH_DIFF, file2, file3);
 			exit(127);
 		}
 		if (Fromflag) {
-			if (execl(_PATH_DIFF, args, optarg, argv[argc-2]) ||
-				execl(_PATH_DIFF, args, optarg, argv[argc-1])) {
-				(void)fprintf(stderr, "--from-file error.\n");
-				exit(2);
-			}
+			execl(_PATH_DIFF, _PATH_DIFF, file3, file1);
+			execl(_PATH_DIFF, _PATH_DIFF, file3, file2);
 			exit(127);			
 		}
 	}

Modified: soc2012/jhagewood/diff/hagewood-diff.patch
==============================================================================
--- soc2012/jhagewood/diff/hagewood-diff.patch	Wed Jun 27 01:44:48 2012	(r238365)
+++ soc2012/jhagewood/diff/hagewood-diff.patch	Wed Jun 27 03:16:36 2012	(r238366)
@@ -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 01:08:55.000000000 -0400
++++ jhagewood/diff/diff/diff.c	2012-06-27 03:16:17.000000000 -0400
 @@ -1,4 +1,4 @@
 -/*-
 +/*
@@ -180,7 +180,7 @@
  	{ NULL,				0,			NULL,	'\0'}
  };
  
-@@ -162,14 +162,15 @@ void read_excludes_file(char *);
+@@ -162,10 +162,10 @@ void read_excludes_file(char *);
  int
  main(int argc, char **argv)
  {
@@ -188,19 +188,14 @@
 -	long	 l;
 -	int	 ch, lastch, gotstdin, prevoptind, newarg;
 -	int	 oargc;
-+	char *ep, **oargv, *args, *cmpfile1, *cmpfile2;
++	char *ep, **oargv, *file1, *file2, *file3;
 +	long l;
 +	int ch, lastch, gotstdin, prevoptind, newarg;
 +	int oargc;
  
  	oargv = argv;
  	oargc = argc;
- 	gotstdin = 0;
-+	args = "-";
- 
- 	lastch = '\0';
- 	prevoptind = 1;
-@@ -197,6 +198,7 @@ main(int argc, char **argv)
+@@ -197,6 +197,7 @@ main(int argc, char **argv)
  			break;
  		case 'C':
  		case 'c':
@@ -208,7 +203,7 @@
  			format = D_CONTEXT;
  			if (optarg != NULL) {
  				l = strtol(optarg, &ep, 10);
-@@ -213,6 +215,9 @@ main(int argc, char **argv)
+@@ -213,6 +214,9 @@ main(int argc, char **argv)
  		case 'd':
  			dflag = 1;
  			break;
@@ -218,14 +213,20 @@
  		case 'e':
  			format = D_EDIT;
  			break;
-@@ -296,15 +301,38 @@ main(int argc, char **argv)
+@@ -296,15 +300,44 @@ main(int argc, char **argv)
  		case 'y':
  			yflag = 1;
  			break;
 +		case OPT_FFILE:
 +			Toflag = 1;
++			file1 = argv[argc-2];
++			file2 = argv[argc-1];
++			file3 = optarg;
 +			break;
 +		case OPT_TOFILE:
++			file1 = argv[argc-2];
++			file2 = argv[argc-1];
++			file3 = optarg;
 +			Fromflag = 1;
 +			break;
 +		case OPT_NEW_LF:
@@ -265,40 +266,31 @@
  		case OPT_STRIPCR:
  			strip_cr=1;
  			break;
-@@ -328,20 +356,46 @@ main(int argc, char **argv)
+@@ -328,20 +361,37 @@ main(int argc, char **argv)
  		lastch = ch;
  		newarg = optind != prevoptind;
  		prevoptind = optind;
 +		
-+		/* For use when executing to-file and from-file options. */
-+		if (ch != OPT_FFILE && ch != OPT_TOFILE) {
-+			strcat(args, ch);
-+		}
  	}
  	argc -= optind;
  	argv += optind;
 -
 -	if(yflag) {
 +	
++	/* XXX to do- pass arguements */
 +	if (Toflag || Fromflag) {
 +		if (Toflag && Fromflag) {
 +			(void)fprintf(stderr, "--from-file and --to-file both specified.\n");
 +			exit(2);
 +		}
 +		if (Toflag) {
-+			if (execl(_PATH_DIFF, args, argv[argc-2], optarg) ||
-+				execl(_PATH_DIFF, args, argv[argc-1], optarg)) {
-+				(void)fprintf(stderr, "--to-file error.\n");
-+				exit(2);				
-+			}
++			execl(_PATH_DIFF, _PATH_DIFF, file1, file3);
++			execl(_PATH_DIFF, _PATH_DIFF, file2, file3);
 +			exit(127);
 +		}
 +		if (Fromflag) {
-+			if (execl(_PATH_DIFF, args, optarg, argv[argc-2]) ||
-+				execl(_PATH_DIFF, args, optarg, argv[argc-1])) {
-+				(void)fprintf(stderr, "--from-file error.\n");
-+				exit(2);
-+			}
++			execl(_PATH_DIFF, _PATH_DIFF, file3, file1);
++			execl(_PATH_DIFF, _PATH_DIFF, file3, file2);
 +			exit(127);			
 +		}
 +	}
@@ -317,7 +309,7 @@
  		execv(_PATH_SDIFF, oargv);
  		_exit(127);
  	}
-@@ -380,7 +434,10 @@ main(int argc, char **argv)
+@@ -380,7 +430,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)
@@ -329,7 +321,7 @@
  		diffdir(argv[0], argv[1]);
  	} else {
  		if (S_ISDIR(stb1.st_mode)) {
-@@ -402,11 +459,10 @@ main(int argc, char **argv)
+@@ -402,11 +455,10 @@ main(int argc, char **argv)
  void *
  emalloc(size_t n)
  {
@@ -342,7 +334,7 @@
  	if ((p = malloc(n)) == NULL)
  		errx(2, NULL);
  	return (p);
-@@ -415,7 +471,7 @@ emalloc(size_t n)
+@@ -415,7 +467,7 @@ emalloc(size_t n)
  void *
  erealloc(void *p, size_t n)
  {
@@ -351,7 +343,7 @@
  
  	if (n == 0)
  		errx(2, NULL);
-@@ -431,13 +487,12 @@ erealloc(void *p, size_t n)
+@@ -431,13 +483,12 @@ erealloc(void *p, size_t n)
  int
  easprintf(char **ret, const char *fmt, ...)
  {
@@ -367,7 +359,7 @@
  	if (len < 0 || *ret == NULL)
  		errx(2, NULL);
  	return (len);
-@@ -446,11 +501,12 @@ easprintf(char **ret, const char *fmt, .
+@@ -446,11 +497,12 @@ easprintf(char **ret, const char *fmt, .
  char *
  estrdup(const char *str)
  {
@@ -382,7 +374,7 @@
  	strlcpy(cp, str, len);
  	return (cp);
  }
-@@ -531,6 +587,7 @@ push_ignore_pats(char *pattern)
+@@ -531,6 +583,7 @@ push_ignore_pats(char *pattern)
  void
  print_only(const char *path, size_t dirlen, const char *entry)
  {
@@ -390,7 +382,7 @@
  	if (dirlen > 1)
  		dirlen--;
  	printf("Only in %.*s: %s\n", (int)dirlen, path, entry);
-@@ -539,45 +596,46 @@ print_only(const char *path, size_t dirl
+@@ -539,45 +592,46 @@ print_only(const char *path, size_t dirl
  void
  print_status(int val, char *path1, char *path2, char *entry)
  {
@@ -448,7 +440,7 @@
  		break;
  	}
  }
-@@ -585,6 +643,7 @@ print_status(int val, char *path1, char 
+@@ -585,6 +639,7 @@ print_status(int val, char *path1, char 
  void
  usage(void)
  {


More information about the svn-soc-all mailing list