Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2012 23:06:37 +0000
From:      jhagewood@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r240511 - in soc2012/jhagewood: diff sdiff
Message-ID:  <20120818230637.60F4B106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhagewood
Date: Sat Aug 18 23:06:37 2012
New Revision: 240511
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240511

Log:

Modified:
  soc2012/jhagewood/diff/decompress.c
  soc2012/jhagewood/diff/diffreg.c
  soc2012/jhagewood/sdiff/decompress.c

Modified: soc2012/jhagewood/diff/decompress.c
==============================================================================
--- soc2012/jhagewood/diff/decompress.c	Sat Aug 18 22:59:06 2012	(r240510)
+++ soc2012/jhagewood/diff/decompress.c	Sat Aug 18 23:06:37 2012	(r240511)
@@ -68,7 +68,7 @@
 	int i = 0;
 	gzFile *comprfile; 
 	
-	file = fopen("/tmp/zdiff.XXXXXXXX", "w+");
+	file = tmpfile();
 	comprfile = gzopen(filename, mode);
 	
 	if (comprfile == Z_NULL)
@@ -87,17 +87,3 @@
 	
 	return file;
 }
-
-/* Checks for a gz file extension. */
-int
-isgzip(char *filename) 
-{
-
-	int length = (sizeof filename)-1;
-	
-	if (filename[length-1] == 'g' && filename[length] == 'z')
-		return 1;
-
-	return 0;
-	
-}

Modified: soc2012/jhagewood/diff/diffreg.c
==============================================================================
--- soc2012/jhagewood/diff/diffreg.c	Sat Aug 18 22:59:06 2012	(r240510)
+++ soc2012/jhagewood/diff/diffreg.c	Sat Aug 18 23:06:37 2012	(r240511)
@@ -192,7 +192,6 @@
 };
 
 extern FILE *decompressfile(char *, char *);
-extern int isgzip(char *);
 
 static FILE	*opentemp(const char *);
 static void output(char *, FILE *, char *, FILE *, int);
@@ -339,10 +338,6 @@
 		} else if (strcmp(file1, "-") == 0)
 			f1 = stdin;
 		else {
-			if (isgzip(file1))
-				filebehave = FILE_GZIP;
-			else
-				filebehave = FILE_NORMAL;
 			if (filebehave == FILE_NORMAL) 
 				f1 = fopen(file1, "r");
 			if (filebehave == FILE_GZIP) {
@@ -369,10 +364,6 @@
 		} else if (strcmp(file2, "-") == 0)
 			f2 = stdin;
 		else {
-			if (isgzip(file1))
-				filebehave = FILE_GZIP;
-			else
-				filebehave = FILE_NORMAL;
 			if (filebehave == FILE_NORMAL) 
 				f2 = fopen(file2, "r");
 			if (filebehave == FILE_GZIP)

Modified: soc2012/jhagewood/sdiff/decompress.c
==============================================================================
--- soc2012/jhagewood/sdiff/decompress.c	Sat Aug 18 22:59:06 2012	(r240510)
+++ soc2012/jhagewood/sdiff/decompress.c	Sat Aug 18 23:06:37 2012	(r240511)
@@ -67,7 +67,7 @@
 	int i = 0;
 	gzFile *comprfile; 
 	
-	file = fopen("/tmp/zdiff.XXXXXXXX", "w+");
+	file = tmpfile();
 	comprfile = gzopen(filename, mode);
 	
 	if (comprfile == Z_NULL)



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