[comp.soft-sys.andrew] Modification so bush handles compressed files.

grahamd@otc.otca.oz.AU (Graham Dumpleton) (03/02/90)

We use bush here as a quick way of getting access to local information
files; ie. we have 'Info-local' bound to 'bush /usr/local/information'
in the window manager setup file. Now, one of the things we keep in
/usr/local/information is compressed listings for remote ftp and
fetchfile sites, but the standard bush doesn't understand the concept of
compressed files.

Ideally one would have an object which could read and write a compressed
files and then having an addfiletype in your .ezinit file. You could
probably even make it so that it understood compressed Andrew files; ie
foo.ez.Z. I would have to think a bit about how to do this though; not
having written an Andrew inset, so I made the following quick change to
bush until I do get around to creating such a thing.

It only works for viewing a file, ie. double clicking on an entry,
obviously it doesn't work for editing.

Hope that some one else finds this feature as useful as we have.

Graham Dumpleton (grahamd@otc.otca.oz.au)



*** bushv.c.dist	Thu Nov 23 03:52:30 1989
--- bushv.c	Fri Mar  2 17:21:03 1990
***************
*** 1633,1641 ****
      PostCursor(self,Cursor_Wait);
      Object = entry_object;
      sprintf(file_name,"%s/%s",bush_DirPath(Bush,CurrNode),CurrEntry->name);
!     sprintf(msg,"reading '%s'",file_name);
!     bushv_Announce(self,msg);
!     if(EntryFilep = fopen(file_name,"r")) {
  	objectName = filetype_Lookup(EntryFilep,file_name,&objectID,NULL); 
  	if(!objectName) objectName = "text";
  	if(EntryView) {
--- 1633,1669 ----
      PostCursor(self,Cursor_Wait);
      Object = entry_object;
      sprintf(file_name,"%s/%s",bush_DirPath(Bush,CurrNode),CurrEntry->name);
! 
!     if (
! 	 strlen(file_name) > 2
! 	 &&
! 	 strcmp(file_name+strlen(file_name)-2, ".Z") == 0
!        )
!     {
! 	char tmpfile[MAXPATHLEN];
! 	char command[MAXPATHLEN+32];
! 
! 	sprintf(msg,"uncompressing '%s'",file_name);
! 	bushv_Announce(self,msg);
! 
! 	sprintf(tmpfile, "/tmp/bush.%d", getpid());
! 	sprintf(command, "cat %s | /usr/ucb/uncompress > %s", file_name, tmpfile);
! 	system(command);
! 
! 	sprintf(msg,"reading '%s'",tmpfile);
! 	bushv_Announce(self,msg);
! 
! 	EntryFilep = fopen(tmpfile,"r");
! 	unlink(tmpfile);
!     }
!     else
!     {
! 	sprintf(msg,"reading '%s'",file_name);
! 	bushv_Announce(self,msg);
! 	EntryFilep = fopen(file_name,"r");
!     }
! 
!     if(EntryFilep) {
  	objectName = filetype_Lookup(EntryFilep,file_name,&objectID,NULL); 
  	if(!objectName) objectName = "text";
  	if(EntryView) {