Mods to pathalias to recognize compressed input files

Keeper Of News tony at xios.UUCP
Thu Oct 2 02:27:22 AEST 1986


Anyone who has tried mac at esl.UUCP's patch to pathalais has probably
noticed that you quickly run out of processses.  I find it hard to
believe that this patch has ever worked, unless on his system fclose
(actually freopen) knows that the file it is closing is a pipe and does
a wait() automagicly. 

Here is a fix, just add it near the beginning of yywrap at the end of
parse.y. 


	while (*Ifiles) {
		Lineno = 1;
+		if( Cfile != NULL &&
+			strcmp(Cfile + strlen(Cfile) - 2, ".Z") == 0) { 
+				/*
+				 * Ignore the case where it ends in .Z but is not compressed
+				 * This is the hight of paranoia, and is more effort than I wish
+				 * to exert tonight.
+				 */
+				pclose(stdin);
+				}
		if (freopen((Cfile = *Ifiles++), "r", stdin)){
			/* if compacted, undo .. */
			if (strcmp(Cfile + strlen(Cfile) - 2, ".Z") == 0) { 
				/* Check the magic number */

-- 
-------------------------------------------------------------------------------
Tony Lill	Keeper of News @ Xios Systems Corporation 
				 1600 Carling Avenue, Suite 150, Ottawa,
				 Ontario, Canada, K1Z 8R8	(613) 725-5411
				 xios!tony
-------------------------------------------------------------------------------
		Not the edge of the world, but we can see it from here.



More information about the Comp.sources.unix mailing list