
October 5, 1992

NOTE:  The following file documents changes made by Paul Kienitz to 
       support Manx Aztec C.  Since the following changes were performed
       against the Unzip 5.0 FCS base, the work done on file_io.c should
       be disregarded.  All of the other changes were migrated to version
       5.1b by John Bush, and should be present in any subsequent official
       release by Info-Zip.

       Crypt.c version 2.0a has not yet been ported.  Work is in progress.

       The Makefile for Aztec C name was changed to Makefile.ATC to prevent
       confusion with others.

-JB


From Paul:
==============================================================================



I've gotten UnZip 5 and ZipInfo to compile with Aztec C 5.2b, and I think
they are working okay, but I HAVE NOT TRIED THE ENCRYPTION PART because I
don't have the crypt.c source file.  I have changed these files:

  unzip.h                a few #ifdef'd declarations and includes
  file_io.c              faked up no-echo input of passwords
  mapname.c              added a #define to make mkdir() work
  zipinfo.c              simply added "ULONG crc32val;" to declarations
  amiga/utime.c          different #includes for prototypes and pragmas
  amiga/stat.c           several weird things

I also created two new files: "amiga/z-stat.h" and "amiga/makefile".  The
former gets #included by amiga/stat.c and by unzip.h; it is a replacement for
the Aztec supplied stat.h file, which is not usable.  The latter is a
makefile for Aztec C 5.0 or newer.

I'm pretty sure that none of my changes affected compiling with other
versions.

=============================================================================

Here are the diffs for unzip.h, applied to the version including John Bush's
"amiga50" diffs ... he #defined O_BINARY and pulled in <sys/stat.h> and
<proto/dos.h> just above the line saying "Next, a word from our Unix (mostly)
sponsors"; I used different versions of those for Aztec and moved the whole
thing up above the "#ifdef MODERN" that preceded the place where he put it.
Note that I defined O_BINARY as zero.  This may be bogus, but there's no bit
in the Aztec fcntl.h that I dare to use as a synonym, and it seems to work
for UnZip and ZipInfo at least ... dunno about Zip.

127c127
< #  if !defined(THINK_C) && !defined(MPW)
---
> #  if !defined(THINK_C) && !defined(MPW) && !defined(AZTEC_C)
132a133,147
> #ifdef AMIGA
> #  ifdef AZTEC_C
> #    include <clib/dos_protos.h>
> #    include <pragmas/dos_lib.h>
> #    include "amiga/z-stat.h"
> #    define MODERN
> #    define O_BINARY 0
> #  else
> #    include <sys/stat.h>
> #    include <proto/dos.h>
> #    define O_BINARY O_RAW
> #  endif
> #  include <time.h>
> #endif
> 
159,165d173
< #ifdef AMIGA
< #include <time.h>
< #include <sys/stat.h>
< #include <proto/dos.h>
< #define O_BINARY O_RAW
< #endif
< 
650,651c658,661
< typedef unsigned short    UWORD;
< typedef unsigned long     ULONG;
---
> #ifndef AMIGA
> typedef unsigned short    UWORD;
> typedef unsigned long     ULONG;
> #endif /* !AMIGA */              /* those are defined in libraries/dos.h */

=============================================================================

Here are the diffs for file_io.c, applied after John Bush's patch for
replacing SetFileDate() with utime() under AmigaDOS 1.x ... they implement a
fake way of no-echo password input by setting the console's foreground and
background colors both to zero, so everything you type echoes as what appears
to be a space ... ****** NOTE!  Under Aztec, I try to prevent ctrl-C exits
during this no-echo state using the variable Enable_Abort; something similar
had better be done for SAS and DICE ... ****** NOTE ALSO, this is completely
untested because I haven't compiled the crypt version:

1073a1102,1110
> #ifdef AMIGA
> # ifdef AZTEC_C
>     extern int Enable_Abort;
>     Enable_Abort = 0;
> # endif
>     
>     write(f, 8, "\033[30;40m");  /* foreground & background both color 0 */
>     echofd = f;
> #else /* AMIGA */
1079a1117
> #endif /* !AMIGA */
1086a1125,1133
> #ifdef AMIGA
> # ifdef AZTEC_C
>     extern int Enable_Abort;
>     Enable_Abort = 1;
> # endif
> 
>     if (echofd != -1)
>         write(f, 8, "\033[31;40m");    /* restore FG color 1, BG color 0 */
> #else /* AMIGA */
1094a1142
> #endif /* !AMIGA */

=============================================================================

For zipinfo.c, simply add the line "ULONG crc32val;" anywhere in the upper
part of the program ... I put it at line 142.

=============================================================================

Here is the diff for amiga/utime.c -- mainly I just changed the includes, but
I also made things a bit more lint-concious:

11,12c11,22
< #include <proto/exec.h>
< #include <proto/dos.h>
---
> #ifdef AZTEC_C
> #  include <clib/exec_protos.h>
> #  include <clib/dos_protos.h>
> #  include <pragmas/exec_lib.h>
> #  include <pragmas/dos_lib.h>
> #  define ESRCH  ENOENT
> #  define EOSERR EIO
> int _OSERR;
> #else
> #  include <proto/exec.h>
> #  include <proto/dos.h>
> #endif
88c98
<     argv[0] = NULL;
---
>     argv[0] = (LONG)NULL;
121c131
<     struct MsgPort *replyport;
---
>     struct MsgPort *replyport, *CreatePort();
126c136
<     if( !replyport ) return(NULL);
---
>     if( !replyport ) return(0);
133c143
<         return(NULL);
---
>         return(0);

=============================================================================

In amiga/stat.c, I changed the includes similarly to in amiga/utime.c, I
removed an extra line where a field gets set twice, and added some
miscellaneous junk at the bottom ...  ***** NOTE that this now pulls in a new
file called amiga/z-stat.h, and that unzip.h also pulls that in:

1c1
< /* stat.c -- for Lattice 4.01 */
---
> /* stat.c -- for Lattice 4.01 or Aztec 5.2b */
7,16c7,23
< #include <proto/exec.h>
< #include <proto/dos.h>
< 
< #include <sys/types.h>
< #include <sys/stat.h>
< 
---
> #ifdef AZTEC_C
> #  include <clib/exec_protos.h>
> #  include <clib/dos_protos.h>
> #  include <pragmas/exec_lib.h>
> #  include <pragmas/dos_lib.h>
> #  include "amiga/z-stat.h"
> #else
> #  include <sys/types.h>
> #  include <sys/stat.h>
> #  include <proto/exec.h>
> #  include <proto/dos.h>
> #endif
> 
> /* The Aztec stat.h header is completely unsuitable, since it defines only */
> /* a very minimal struct stat with no st_mode field.  So we roll our own,  */
> /* which needs to be pulled in by unzip.h for everyone who calls stat().   */
> 
80,97c87,90
<         buf->st_mtime =
<         buf->st_mtime = ftime;
---
>         buf->st_mtime = ftime;
126a120,135
> 
> 
> #ifdef AZTEC_C
> 
> /* This here removes unnecessary bulk from the executable with Aztec: */
> void _wb_parse()  { }
> 
> /* This here pretends we have time zone support and suchlike when we don't: */
> long timezone = 0;
> void tzset()  { }
> /* AmigaDOS only has timezone awareness in release 2.1 and newer. */
> 
> int umask()  { return 0; }
> 
> #endif

=============================================================================

Here's the diff for mapname.c:

53c53,57
< #      define MKDIR(path,mode)   mkdir(path,mode)
---
> #      if (defined(AMIGA) && defined(AZTEC_C))
> #        define MKDIR(path,mode) mkdir(path)
> #      else
> #        define MKDIR(path,mode) mkdir(path,mode)
> #      endif /* ?(AMIGA && AZTEC_C) */


=============================================================================

This file should be accompanied by the files amiga/z-stat.c and
amiga/makefile for a complete package.  The files amiga/stat.c and
amiga/utime.c might as well be thrown in too.

