Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2012 05:13:31 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r240318 - soc2012/jhagewood/sdiff
Message-ID:  <20120813051332.1BE5A106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Mon Aug 13 05:13:31 2012
New Revision: 240318
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240318

Log:
  Added -lz flags to compile options in sdiff's Makefile.

Modified:
  soc2012/jhagewood/sdiff/Makefile
  soc2012/jhagewood/sdiff/sdiff.c

Modified: soc2012/jhagewood/sdiff/Makefile
==============================================================================
--- soc2012/jhagewood/sdiff/Makefile	Mon Aug 13 04:35:38 2012	(r240317)
+++ soc2012/jhagewood/sdiff/Makefile	Mon Aug 13 05:13:31 2012	(r240318)
@@ -15,8 +15,8 @@
 #.endif
 
 PROG= sdiff zsdiff
-SRCS= common.c edit.c sdiff.c
-COPTS+= -Wall -W
+SRCS= common.c edit.c sdiff.c decompress.c
+COPTS+= -Wall -W -lz
 
 LDADD+=	-lutil
 DPADD+=	${LIBUTIL}

Modified: soc2012/jhagewood/sdiff/sdiff.c
==============================================================================
--- soc2012/jhagewood/sdiff/sdiff.c	Mon Aug 13 04:35:38 2012	(r240317)
+++ soc2012/jhagewood/sdiff/sdiff.c	Mon Aug 13 05:13:31 2012	(r240318)
@@ -89,10 +89,10 @@
 int Iflag = 0;	/* ignore sets matching regexp */
 int	lflag;		/* print only left column for identical lines */
 int	sflag;		/* skip identical lines */
+int filebehave;	/* open file behavior */
 FILE *outfp;		/* file to save changes to */
 const char *tmpdir;	/* TMPDIR or /tmp */
-char *pn;		/* program name */
-char *filebehave;	/* open file behavior */
+const char *pn;		/* program name */
 	
 enum {
 	    HELP_OPT = CHAR_MAX + 1,
@@ -470,6 +470,9 @@
 				warn("Error deleting %s.", tmp2);
 		free(tmp1);
 		free(tmp2);
+		if (filebehave == FILE_GZIP) {
+			diffprog = ZDIFF_PATH;
+		}
 		binexec(diffprog, filename1, filename2);
 	}
 	/* Line numbers start at one. */
@@ -526,16 +529,11 @@
 binexec(char *diffprog, char *f1, char *f2)
 {
 	
-	char *args[];
-	
-	if (filebehave == FILE_GZIP) {
-		diffprog = ZDIFF_PATH;
-	}
-	args[] = {diffprog, f1, f2, (char *) 0};
+	char *args[] = {diffprog, f1, f2, (char *) 0};
 	execv(diffprog, args);
-	/* If execv() fails, sdiff's execution will continue. */
-	sprintf(stderr, "Could not execute diff process.\n");
-	exit(1);
+	
+	/* If execv() fails, sdiff's execution will continue below. */
+	errx(1, "Could not execute diff process.\n");
 }
 
 /*



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