{
***************************************************************************
* PACK! - for (2/12/92)                                                   *
* FRINGDUS - The Game.                                                    *
*                                                                         *
*  By Jason Nunn (JsNO BAR----NUNN)                                       *
*                                                                         *
* Email: nunn@pandanus.cs.ntu.edu.au                                      *
*                                                                         *
***************************************************************************
}
program pack;

var
  bigpic_file   : file;
  pic_file      : file;
  pack_ini      : text;
  pic_file_name : string[15];
  pic_buff      : array[0..899] of byte;
  nr, nw        : word;

{
***************************************************************************
*                                                                         *
***************************************************************************
}

begin
  if paramstr(1) = '-h' then
  begin
    writeln;
    writeln('PACK - By Jason Nunn - (C) 1992 - This Game is Freeware');
    writeln;
    writeln('Instructions: Read Manual (readme.txt)');
    writeln;
  end
  else
  begin
    assign(bigpic_file, 'fringpc1.pic');
    {$I-}
    rewrite(bigpic_file, 1);
    {$I+}
    if ioresult = 0 then
    begin
      assign(pack_ini, 'pack.ini');
      {$I-}
      reset(pack_ini);
      {$I+}
      if ioresult = 0 then
      begin
        writeln('PACKING...sprite files...');

        while not eof(pack_ini) do
        begin
          readln(pack_ini, pic_file_name);
          if (pic_file_name <> '') and (pic_file_name[1] <> '#') then
          begin
            writeln(pic_file_name, ' -> ', 'fringpc1.pic');
            assign(pic_file, pic_file_name);
            {$I-}
            reset(pic_file, 1);
            {$I+}
            if ioresult = 0 then
            begin
              blockread(pic_file, pic_buff, sizeof(pic_buff), nr);
              blockwrite(bigpic_file, pic_buff, nr, nw);
              close(pic_file);
            end
            else
            begin
              write('  FILE DOESN`T EXIST! (ABEND)');
              writeln;
              halt;
            end;
          end
        end;
        close(pack_ini);
        writeln;
        writeln('Done!');
      end
      else
      begin
        writeln('PACK.INI Not found');
      end
    end
  end
end.
