#include <exec/types.h>
#include <exec/memory.h>
#include <proto/exec.h>
#include <proto/dos.h>

#define ARP "arp.library"
#define OUT "LIBS:arp.library"

void main(void);

/**************************************************************************/
/***    compile:    lc -v -cusf ARPtoDF0.c  (Lattice 5.04)              ***/
/***                                                                    ***/
/***    link with:  FROM LIB:c.o,ARPtoDF0.o                             ***/
/***                TO ARPtoDF0                                         ***/
/***                LIB LIB:lc.lib,LIB:amiga.lib                        ***/
/***                DEFINE __main = __tinymain                          ***/
/**************************************************************************/

void main()
{
BPTR inhandle,outhandle;
BYTE *buf,h = 0;
LONG size;

    if (inhandle = Open(ARP,1005))
    {   Seek(inhandle,0,1);
        size = Seek(inhandle,0,-1);
        if (buf = (BYTE *)AllocMem(size,MEMF_PUBLIC))
        {   if(Read(inhandle,buf,size) == size)
            {   if(outhandle = Open(OUT,1006))
                {   if(Write(outhandle,buf,size) != size)
                    {   h = 1;
                    }
                    Close(outhandle);
                    if(h)
                    {    DeleteFile(OUT);
                    }
                }
            }
            FreeMem(buf,size);
        }
        Close(inhandle);
    }
}

