Unofficcial portability patch to compress 4.0

Robert Claeson prc at erbe.se
Thu Aug 16 21:31:49 AEST 1990


I have had a few problems to make compress 4.0 compile properly on
a number of systems without some tweaks in the Makefile. Furthermore,
many System V unix'es uses file systems with long file names. I
have felt it unneccesary to have compress complain when the file
to be compressed has a name that is longer than 12 characters unless
it really is run on a system that uses a file system with 14 character
filenames.

A more generic fix would be to have compress inquire (in some way) the
number of characters a filename can have from the file system, since
many different file systems can be in use on a system at the same time.

Anyway, here is the patch. It shouldn't break anything that isn't broken.


*** Makefile.old	Thu Aug 16 13:19:35 1990
--- Makefile	Thu Aug 16 11:24:55 1990
***************
*** 1,19 ****
  CC=cc
  COMFLAGS=-O
  BIN=/usr/bin
  MAN=/usr/man/man1
  #define to "l" if manuals go on /usr/man/manl
  L=1
  
  all :	compress atob btoa
  
! compress : compress.c USERMEM
! 	$(CC) $(COMFLAGS) -DUSERMEM=`cat USERMEM` -o compress compress.c
  
! # USERMEM may have to be set by hand.  It should contain the amount of
! # available user memory in bytes.  See the README file for more info.
! USERMEM:
! 	sh usermem > USERMEM
  
  atob:	atob.c
  	$(CC) $(COMFLAGS) -o atob atob.c
--- 1,17 ----
  CC=cc
  COMFLAGS=-O
  BIN=/usr/bin
  MAN=/usr/man/man1
  #define to "l" if manuals go on /usr/man/manl
  L=1
  
  all :	compress atob btoa
  
! # add "-DSHORT_FILENAMES" to the command line below if S51K file system is
! # in use.
  
! compress : compress.c
! 	$(CC) $(COMFLAGS) -DBITS=16 -o compress compress.c
  
  atob:	atob.c
  	$(CC) $(COMFLAGS) -o atob atob.c
*** compress.c.old	Thu Aug 16 13:19:55 1990
--- compress.c	Thu Aug 16 11:22:51 1990
***************
*** 590,596 ****
  
  		/* Generate output filename */
  		strcpy(ofname, *fileptr);
! #ifndef BSD4_2		/* Short filenames */
  		if ((cp=rindex(ofname,'/')) != NULL)	cp++;
  		else					cp = ofname;
  		if (strlen(cp) > 12) {
--- 590,596 ----
  
  		/* Generate output filename */
  		strcpy(ofname, *fileptr);
! #ifdef SHORT_FILENAMES		/* Short filenames */
  		if ((cp=rindex(ofname,'/')) != NULL)	cp++;
  		else					cp = ofname;
  		if (strlen(cp) > 12) {
***************
*** 597,603 ****
  		    fprintf(stderr,"%s: filename too long to tack on .Z\n",cp);
  		    continue;
  		}
! #endif  /* BSD4_2		Long filenames allowed */
  		strcat(ofname, ".Z");
  	    }
  	    /* Check for overwrite of existing file */
--- 597,603 ----
  		    fprintf(stderr,"%s: filename too long to tack on .Z\n",cp);
  		    continue;
  		}
! #endif  /* SHORT_FILENAMES		Long filenames allowed */
  		strcat(ofname, ".Z");
  	    }
  	    /* Check for overwrite of existing file */
-- 
Robert Claeson                  |Reasonable mailers: rclaeson at erbe.se
ERBE DATA AB                    |      Dumb mailers: rclaeson%erbe.se at sunet.se
                                |  Perverse mailers: rclaeson%erbe.se at encore.com
These opinions reflect my personal views and not those of my employer (ask him).



More information about the Comp.sources.bugs mailing list