[comp.sys.amiga] compress 4.0 for the amiga

phil@adam.adelaide.edu.au (Phil Kernick) (10/30/90)

I have just posted compress for the amiga on NewXanth (abcfd20.larc.nasa.gov)
in the file /incoming/amiga/amipress.zoo

This is a direct port of the unix compress 4.0 sources, so now you can
compress/decompress/zcat all of those lovely .Z files at home.

The executable compress is also decompress and zcat, just copy it to
the other names for the other functions (oh for soft links...).

The source is the original with a couple of #ifdef AMIGA stuffed in
the appropriate places but you will not be able to compile it without
my unix.lib which I am currently not releasing to the public.

Phil.


-- 
Phil Kernick                            EMail:  phil@adam.adelaide.edu.au
Departmental Engineer                   Phone:  +618 228 5914
Dept. of Psychology                     Fax:    +618 224 0464
University of Adelaide                  Mail:   GPO Box 498 Adelaide SA 5001

JAGBDED%PANAM.BITNET@ricevm1.rice.edu (10/31/90)

In <phil.657263246@adam.adelaide.edu.au> Phil Kernic writes:
>I have just posted compress for the amiga on NewXanth (abcfd20.larc.nasa.gov)
>in the file /incoming/amiga/amipress.zoo
>
>This is a direct port of the unix compress 4.0 sources, so now you can
>compress/decompress/zcat all of those lovely .Z files at home.
>
>The executable compress is also decompress and zcat, just copy it to
>the other names for the other functions (oh for soft links...).
>
>The source is the original with a couple of #ifdef AMIGA stuffed in
>the appropriate places but you will not be able to compile it without
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>my unix.lib which I am currently not releasing to the public.
 ^^^^^^^^^^^
>Phil Kernick                            EMail:  phil@adam.adelaide.edu.au

   I was able to compile compress 4.0 from prep.ai.mit.edu using SAS/Lattice
C 5.10 by simply commenting out the calls to chown and utime, safe enough I
think on a small machine.   It's worked on everything I've thrown at it so
far. It seems that the folks  at Lattice did a good job with their support
library.

Joe Gonzalez
JAGBDED@PANAM (BITNET)
jagbded%panam.bitnet@ricevm1.rice.edu

ked01@ccc.amdahl.com (Kim DeVaughn) (11/08/90)

In article <35043@nigel.ee.udel.edu> JAGBDED%PANAM.BITNET@ricevm1.rice.edu writes:
> 
> In <phil.657263246@adam.adelaide.edu.au> Phil Kernic writes:
> >I have just posted compress for the amiga on NewXanth (abcfd20.larc.nasa.gov)
> >in the file /incoming/amiga/amipress.zoo
> >
> >The executable compress is also decompress and zcat, just copy it to
> >the other names for the other functions (oh for soft links...).

Which were *supposed* to be "in there" for 2.0 ... but eveidently are NOT, from
what has been said here on c.s.a.*.

However for uncompressing, you *can* use "compress -d" with this version, which
will work just fine (though it isn't really documented in the man page).  For
"zcat", I guess you still need to duplicate the binary using that name.


>    I was able to compile compress 4.0 from prep.ai.mit.edu using SAS/Lattice
> C 5.10 by simply commenting out the calls to chown and utime, safe enough I
> think on a small machine.   It's worked on everything I've thrown at it so
> far. It seems that the folks  at Lattice did a good job with their support
> library.

Perhaps you would post your version to comp.{sources|binaries}.amiga, or put
it up on abcfd20 Joe, as the version Phil put up has a very annoying problem.
That being it has the 12-char filename limit (14 including the .Z suffix)
compiled in (which is only needed for SysV's ... not AmigaDOS) ...

Or maybe Phil could fix his version ...?

/kim

-- 
UUCP:  kim@uts.amdahl.com   -OR-   ked01@juts.ccc.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,uunet,oliveb,ames}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
BIX:   kdevaughn     GEnie:   K.DEVAUGHN     CIS:   76535,25

kim@uts.amdahl.com (Kim DeVaughn) (11/08/90)

In article <4bFX02yd03bo01@JUTS.ccc.amdahl.com> I wrote:
> 
> However for uncompressing, you *can* use "compress -d" with this version, which
> will work just fine (though it isn't really documented in the man page).  For
> "zcat", I guess you still need to duplicate the binary using that name.

I'd forgotten that for the "zcat" function, "compress -cd" will work just fine
as an alias, or whatever.

/kim

-- 
UUCP:  kim@uts.amdahl.com   -OR-   ked01@juts.ccc.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,uunet,oliveb,ames}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
BIX:   kdevaughn     GEnie:   K.DEVAUGHN     CIS:   76535,25

kim@uts.amdahl.com (Kim DeVaughn) (11/08/90)

In article <4bFX02yd03bo01@JUTS.ccc.amdahl.com> I also wrote:
> 
> Perhaps you would post your version to comp.{sources|binaries}.amiga, or put
> it up on abcfd20 Joe, as the version Phil put up has a very annoying problem.
> That being it has the 12-char filename limit (14 including the .Z suffix)
> compiled in (which is only needed for SysV's ... not AmigaDOS) ...
> 
> Or maybe Phil could fix his version ...?

Sorry to drag this out across three followups, but I just noticed another VERY
annoying problem in the version that Phil put up on abcfd20 ... it does NOT
preserve the file's date and time stamp!

Another smaller problem ... when using the -c option (as in zcat), the output
buffer size is such that it is difficult to "block" the output to stdout by
hitting the space-bar (or some other key), as the rest of the buffer gets
dumped before the "blocking" takes effect.  Similarly for ^C breaking.

OK ... I'll shut-up for now ... :-)

/kim


-- 
UUCP:  kim@uts.amdahl.com   -OR-   ked01@juts.ccc.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,uunet,oliveb,ames}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
BIX:   kdevaughn     GEnie:   K.DEVAUGHN     CIS:   76535,25

UH2@psuvm.psu.edu (Lee Sailer) (11/09/90)

>will work just fine (though it isn't really documented in the man page).  For
>"zcat", I guess you still need to duplicate the binary using that name.


While clearly a kludge, you could write a s: script called zcat that
renamed compress, executed it, and then renamed it again.

                                                         lee

Let's call this a mushy link, perhaps 8-)

lphillips@lpami.wimsey.bc.ca (Larry Phillips) (11/10/90)

In <4bFX02yd03bo01@JUTS.ccc.amdahl.com>, ked01@ccc.amdahl.com (Kim DeVaughn) writes:
>In article <35043@nigel.ee.udel.edu> JAGBDED%PANAM.BITNET@ricevm1.rice.edu writes:
>> 
>> In <phil.657263246@adam.adelaide.edu.au> Phil Kernic writes:
>> >I have just posted compress for the amiga on NewXanth (abcfd20.larc.nasa.gov)
>> >in the file /incoming/amiga/amipress.zoo
>> >
>> >The executable compress is also decompress and zcat, just copy it to
>> >the other names for the other functions (oh for soft links...).
>
>Which were *supposed* to be "in there" for 2.0 ... but eveidently are NOT, from
>what has been said here on c.s.a.*.

Well, hard links work, which is better than no links at all. (or at least they
do in the version I'm running.. I don't have 2.02 yet)

>However for uncompressing, you *can* use "compress -d" with this version, which
>will work just fine (though it isn't really documented in the man page).  For
>"zcat", I guess you still need to duplicate the binary using that name.

Just make two hard links, either in the same directory as compress or in a
directory on the same partition. I use a directory called 'C2' for links into
C:.

-larry

--
It is not possible to both understand and appreciate Intel CPUs.
    -D.Wolfskill
+-----------------------------------------------------------------------+ 
|   //   Larry Phillips                                                 |
| \X/    lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322  -or-  76703.4322@compuserve.com        |
+-----------------------------------------------------------------------+

joseph@valnet.UUCP (Joseph P. Hillenburg) (11/10/90)

UH2@psuvm.psu.edu (Lee Sailer) writes:

> While clearly a kludge, you could write a s: script called zcat that
> renamed compress, executed it, and then renamed it again.
> Let's call this a mushy link, perhaps 8-)

What about using aliases, etc? Just have a line in your s:shell-startup 
that is like:

alias zcat c:compress


Joseph Hillenburg, Secretary, Bloomington Amiga Users Group (BAUG)
joseph@valnet.UUCP                         ...!iuvax!valnet!joseph
"Only Apple could slow down a 68000 chip." -Computer Shopper

labb-2ae@e260-2d.berkeley.edu (Joe C.) (11/11/90)

In article <wZ3Ds3w163w@valnet> joseph@valnet.UUCP (Joseph P. Hillenburg) writes:
>UH2@psuvm.psu.edu (Lee Sailer) writes:
>
>> While clearly a kludge, you could write a s: script called zcat that
>> renamed compress, executed it, and then renamed it again.
>> Let's call this a mushy link, perhaps 8-)
>
>What about using aliases, etc? Just have a line in your s:shell-startup 
>that is like:
>
>alias zcat c:compress
>
>
>Joseph Hillenburg, Secretary, Bloomington Amiga Users Group (BAUG)
>joseph@valnet.UUCP                         ...!iuvax!valnet!joseph
>"Only Apple could slow down a 68000 chip." -Computer Shopper

In article <wZ3Ds3w163w@valnet> joseph@valnet.UUCP (Joseph P. Hillenburg) writes:
>UH2@psuvm.psu.edu (Lee Sailer) writes:
>
>> While clearly a kludge, you could write a s: script called zcat that
>> renamed compress, executed it, and then renamed it again.
>> Let's call this a mushy link, perhaps 8-)
>
>What about using aliases, etc? Just have a line in your s:shell-startup 
>that is like:
>
>alias zcat c:compress
>

Writing aliases doesn't work.

When the shell sees an alias, it replaces the alias with the apropriate
substution and executes that replaced line.  So as far as compress is
concerned, it is always invoked as "compress blah blah .... " Compress
checks the command line via argv and argc.  It must find "zcat",
"uncompress", or "compress" at argv[0].

However there may be shells that feed the actual user-entered command line
to a program, though I don't think such a shell would be useful.

What we *really* need is something like the 'ln' command in UNIX.

-jc
---
labb-2ae@web.berkeley.edu

oliphant@telepro.UUCP (Mike Oliphant) (11/14/90)

In article <27dc02lWe25G01@amdahl.uts.amdahl.com>
kim@uts.amdahl.com (Kim DeVaughn) writes:

>Sorry to drag this out across three followups, but I just noticed another VERY
>annoying problem in the version that Phil put up on abcfd20 ... it does NOT
>preserve the file's date and time stamp!

This sparks a question.  How do you modify the datestamp of a file?

--
Mike Oliphant		    UUCP: alberta!herald!telepro!oliphant
			Internet: oliphant@telepro.uucp
			 FidoNet: (1:140/91) - ZMH only
*
* Call TelePro, the development system for DIALOG Professional
*
*   Phone: +1 306 249 2352	2400/9600/14400 bps HST
*	   +1 306 652 2084	300/1200/2400 bps
* FidoNet: (1:140/90)
*

thad@cup.portal.com (Thad P Floryan) (11/17/90)

oliphant@telepro.UUCP (Mike Oliphant) in <oliphant.4412@telepro.UUCP> asks:

	This sparks a question.  How do you modify the datestamp of a file?

The operative phrase is "ACTION_SETDATE" as documented in an AmigaMAIL circa
1987.

For a working example:

	File: 5007.comp-sys-amiga
	Path: ...!sri-unix!sri-spam!rutgers!mit-eddie!uw-beaver!ubc-vision!\
	      van-bc!jlydiatt
	From: jlydiatt@van-bc.UUCP (Jeff Lydiatt)
	Newsgroups: comp.sys.amiga
	Subject: Cp: A replacement for AmigaDos Copy
	Message-ID: <741@van-bc.UUCP>
	Date: 23 May 87 00:54:59 GMT
	Date-Received: 24 May 87 00:47:44 GMT
	Organization: Public Access Network, Vancouver, BC.
	Lines: 1217
	Keywords: AmigaDos Copy Regular Expressions

	Here is a replacement for AmigaDog "copy" program that I have
	been working on for quite a while.  It implements the AmigaDos
	pattern matching algorithm, the "all" command, and has the
	added bonus that it retains the date of copied file.

	It's my first posting to the net, and I have my fingers crossed
	that all goes well...

	Contents:
	cp.doc     - documentation
	cp.c       - the main program
	PatMatch.c - supporting routines to implement the pattern matching.
	setDate.c  - gets and sets the file date.
	wb_parse.c - Aztec allows you to skip the workbench parms parse.
	makefile   - to compile and link the whole thing.
	cp.uue     - uuencoded cp

The "setDate.c" file is enclosed below.  BTW, Jeff's "cp" program permits the
UNIX-like syntax:  ``cp path/filename .''  (where "." means current directory)

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

==================== begin enclosed material ====================

---- Cut Here and unpack ----
#!/bin/sh
# This is a shell archive (shar 3.32)
# made 11/17/1990 07:22 UTC by thad@thadlabs
# Source directory /u/thad/tmp5
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   4628 -rw-r--r-- setDate.c
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= setDate.c ==============
echo "x - extracting setDate.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > setDate.c &&
X/*   <setDate.c>
X */
X
X#include "exec/types.h"
X#include "exec/ports.h"
X#include "exec/io.h"
X#include "exec/memory.h"
X#include "libraries/dos.h"
X#include "libraries/dosextens.h"
X#include <stdio.h>
X#define AZTEC 1
X#ifdef AZTEC
X#include "functions.h"         /* aztec C include */
X#endif
X
X#define ACTION_SETDATE_MODE 34L  /* The packet type we will be playing with */
X#define DOSTRUE 	    -1L  /* AmigaDos TRUE */
X#define MAXARGS              7L  /* limit in packet structure (dosextens.h) */
X#define NARGS		     4L  /* Number of args for setdate */
X
X/*---------------------------------------------------------------------*/
X/*  sendpkt: generalized send a dos packet.			       */
X/*---------------------------------------------------------------------*/
X
Xstatic long sendpkt(pid,action,args,nargs)
X
Xstruct MsgPort *pid;	/* process indentifier ... (handlers message port ) */
Xlong  action,	       /* number of arguments in list */
X      nargs;           /* number of arguments in list  */
XULONG args[];          /* a pointer to a argument list */
X{
X 
X   struct MsgPort        *replyport;
X   struct StandardPacket *packet;
X 
X   long   count, res1; 
X   ULONG  *pargs;
X
X   if(nargs > MAXARGS) return NULL; 
X 
X   replyport = (struct MsgPort *) CreatePort(NULL,NULL); /* make reply port */
X   if(!replyport) return NULL;
X
X   packet = (struct StandardPacket *) 
X      AllocMem((long)sizeof(struct StandardPacket),MEMF_PUBLIC | MEMF_CLEAR);
X   if(!packet) 
X     {
X       FreeMem((void *)packet,(long)sizeof(struct StandardPacket));
X       return(NULL);
X     }
X
X   packet->sp_Msg.mn_Node.ln_Name = (char *) &(packet->sp_Pkt); /* link packet
- */
X   packet->sp_Pkt.dp_Link         = &(packet->sp_Msg);  /* to message    */
X   packet->sp_Pkt.dp_Port         = replyport;         /* set-up reply port */
X   packet->sp_Pkt.dp_Type         = action;           /* what to do... */
X
X   /* move all the arguments to the packet */
X   pargs = (ULONG *)&(packet->sp_Pkt.dp_Arg1);   /* address of first argument 
*/
X   for(count=NULL;count < nargs && count < MAXARGS; ++count) 
X     pargs[count]=args[count];
X
X   PutMsg(pid,packet); /* send packet */
X   (void)WaitPort(replyport); /* wait for packet to come back */
X   (void)GetMsg(replyport);   /* pull message */
X
X   res1 = packet->sp_Pkt.dp_Res1; /* get result */
X
X   /* all done clean up */
X   FreeMem((void *)packet,(long)sizeof(*packet)); 
X   DeletePort(replyport); 
X
X   return(res1); 
X 
X}
X
X/*---------------------------------------------------------------------*/
X/*  setDate: datestamp the given file with the given date.	       */
X/*---------------------------------------------------------------------*/
X
XBOOL setDate( name, date )
Xchar 		 *name;
Xstruct DateStamp *date;
X{
X   struct MsgPort *task;            /* for process id handler */
X   ULONG arg[4];                    /* array of arguments     */
X   char *bstr, strcpy();            /* of file to be set      */
X   long rc;
X   char *strchr();
X   int strlen();
X
X   rc = 0;
X
X   if ( !(bstr = (char *)AllocMem(68L, (long)(MEMF_PUBLIC)))) goto exit2;
X   if ( !(task = (struct MsgPort *)DeviceProc( name )))       goto exit1;
X
X   /* Dos Packet needs the filename in Bstring format */
X 
X   (void)strcpy( bstr+1, name );
X   *bstr = strlen( name );
X
X   arg[0] = (ULONG)NULL;
X   arg[1] = (ULONG)IoErr(); /* lock on parent director set by DeviceProc() */
X   arg[2] = (ULONG) bstr >> 2;
X   arg[3] = (ULONG) date;
X   rc = sendpkt( task, ACTION_SETDATE_MODE, arg, 4L );
X
Xexit1: if ( bstr ) FreeMem( (void *)bstr, 68L );
Xexit2: if ( rc == DOSTRUE )
X          return TRUE;
X       else
X          return FALSE;
X}
X
X/*---------------------------------------------------------------------*/
X/*  getDate: get the datestamp the given file.			       */
X/*---------------------------------------------------------------------*/
X
XBOOL getDate(name, date )
Xchar *name;
Xregister struct DateStamp *date;
X{
X
X   struct FileInfoBlock *Fib;
X   ULONG		FLock;
X   int			result;
X   register struct DateStamp	*d;
X
X   if ( (FLock = (ULONG) Lock(name, (long)(ACCESS_READ) )) == NULL)
X      return FALSE;
X
X   Fib = (struct FileInfoBlock * )
X	AllocMem( (long)sizeof(struct FileInfoBlock), (long)(MEMF_CHIP));
X
X   if (Fib == NULL )
X     result = FALSE;
X   else
X     {
X	if ( !Examine( FLock, Fib ))
X	   result = FALSE;
X	else if ( Fib->fib_DirEntryType > 0 )
X	   result = FALSE;  /* It's a directory */
X        else
X	   {
X		d = &Fib->fib_Date;
X		date->ds_Days   = d->ds_Days;
X		date->ds_Minute = d->ds_Minute;
X		date->ds_Tick   = d->ds_Tick;        
X		result = TRUE;
X	   }
X	FreeMem( (void *)Fib, (long)sizeof(struct FileInfoBlock) );
X     }
X
X   UnLock( FLock );
X   return result;
X}
SHAR_EOF
$TOUCH -am 1116232190 setDate.c &&
chmod 0644 setDate.c ||
echo "restore of setDate.c failed"
set `wc -c setDate.c`;Wc_c=$1
if test "$Wc_c" != "4628"; then
	echo original size 4628, current size $Wc_c
fi
exit 0

==================== end enclosed material ====================

ked01@ccc.amdahl.com (Kim DeVaughn) (11/18/90)

In article <36020@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
> oliphant@telepro.UUCP (Mike Oliphant) in <oliphant.4412@telepro.UUCP> asks:
> 
> 	This sparks a question.  How do you modify the datestamp of a file?
> 
> The operative phrase is "ACTION_SETDATE" as documented in an AmigaMAIL circa
> 1987.
> 
> The "setDate.c" file is enclosed below.  BTW, Jeff's "cp" program permits the
>
> X#define ACTION_SETDATE_MODE 34L  /* The packet type we will be playing with */

Though I wouldn't expect it to change, one should really use ACTION_SET_DATE,
as defined in "libraries/dosextens.h".

I hear tell that there is a regular ol' fn() call to do this under 2.0, BTW.

/kim

-- 
UUCP:  kim@uts.amdahl.com   -OR-   ked01@juts.ccc.amdahl.com
  or:  {sun,decwrl,hplabs,pyramid,uunet,oliveb,ames}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
BIX:   kdevaughn     GEnie:   K.DEVAUGHN     CIS:   76535,25

thad@cup.portal.com (Thad P Floryan) (11/18/90)

ked01@ccc.amdahl.com (Kim DeVaughn) in <86XJ025203c601@JUTS.ccc.amdahl.com>
writes:

	Though I wouldn't expect it to change, one should really use
	ACTION_SET_DATE, as defined in "libraries/dosextens.h".

True.  But ``ACTION_SET_DATE'' simply did NOT exist in the CBM-supplied header
file back then.  It's easy to forget that when a system was evolving rapidly
as the Amiga, we had to alter the headers ourselves or "#define" the stuff
explicitly to avail oneself of "new" CBM-supplied information (as Jeff did with
his "cp" program).

Such a "problem" is common in the computer industry, and I'm not being critical
,
although I will say I was quite disappointed with DEC when they changed a lot
of the headers during the transition from VMS 4.7 to 5.0 which caused numerous
files to cease being compilable (luckily I anticipated that and retained copies
of the original headers :-)

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]