[net.micro.amiga] Amiga Hack Source

jcz@ncsu.UUCP (John A. Toebes, VIII) (02/20/86)

As promised, I am now posting the source to HACK 1.0.1 on the Amiga.
It is being posted in net.sources in 13 pieces:
part1 contains the include files
parts2 through 9 contain the fairly machine independant sources
part10 countains those sources and include files particular to
       the Amiga
part11 contains the runtime data files required by Hack
part12 contains the Amiga .info files and Icons
part13 contains a binary dump of the executable.

In order to make it easier to download to the amiga, I suggest that you
leave the sources together in the grouped files and break them up when
you get them to the Amiga (I make no guarentees on how well it will
compile on other machines although it appears to be ok on our Apollo)

The format of the source files is simple, at the start of each file is
a line of the form #file <fname> where <fname> is the name of the
file.  The program below will break up a file into its individual
components.  To use it, CD to the directory that you wish to hold the
sources, then execute the program (I call it Explode) redirecting the
input to the file to be broken up:
ie
  CD DF1:
  EXPLODE <sources_part1

When you get all the sources there, recompile them with the CCALL
script in part 10 of the sources, then link WITH the LINK_HACK file.

I have almost got graphics working suitable to my tastes and will post
a differences file when it works.

------CUT HERE -------- CUT HERE -------- CUT HERE -------
#include <stdio.h>
main()
{
char buffer[128];
FILE *fp;
fp = NULL;

while(gets(buffer) != NULL)
   {
   if (!strncmp(buffer,"#file ", 6))
      {
      if (fp != NULL)
         fclose(fp);
      if ( (fp = fopen(buffer+6,"w")) == NULL)
         {
         printf("Cannot open file '%s'\n", buffer+6);
         exit(1);
         }
      printf("Writing '%s'\n", buffer+6);
      }
   else if (fp == NULL)
      {
      printf("No file open\n");
      exit(2);
      }
   else
      fprintf(fp,"%s\n",buffer);
   }
if (fp != NULL)
   fclose(fp);
}
-------------------end of source --------------------
John A. Toebes, VIII
120-H Northington Place
Cary NC 27511
(919) 469-4210
Usenet: ...!mcnc!ncsu!jcz