home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / Archivers / xpk_Source.lha / xpk_Source / test / testFileUnpack.c < prev    next >
C/C++ Source or Header  |  1998-02-08  |  1KB  |  60 lines

  1. #define NAME        "testFileUnpack"
  2. #define DISTRIBUTION    "(Freeware) "
  3. #define REVISION    "1"
  4. #define SDI_ENDCODE_NOCTRLC
  5.  
  6. /* Programmheader
  7.  
  8.     Name:        testFileUnpack
  9.     Author:        SDI
  10.     Distribution:    Freeware
  11.     Description:    easy file to file unpacker
  12.     Compileropts:    -
  13.     Linkeropts:    -l xpkmaster amiga
  14.  
  15.  1.0   24.03.97 : first version
  16.  1.1   28.11.97 : moved chunk-hook into include file
  17. */
  18.  
  19. #include <proto/exec.h>
  20. #include <proto/dos.h>
  21. #include <proto/xpkmaster.h>
  22. #include "SDI_defines.h"
  23. #include "chunkhook.c"
  24.  
  25. struct Library        *XpkBase        = 0;
  26. ULONG            DosVersion        = 37;
  27. struct RDArgs        *rda            = 0;
  28.  
  29. #define PARAM "FROM/A,TO/A"
  30.  
  31. void main(void)
  32. {
  33.   UBYTE errbuf[XPKERRMSGSIZE+1];
  34.   struct {
  35.     STRPTR from;
  36.     STRPTR to;
  37.   } args = {0,0};
  38.  
  39.   if(!(rda = ReadArgs(PARAM, (LONG *) &args, 0)) ||
  40.   !(XpkBase = OpenLibrary(XPKNAME, 3)))
  41.     End(RETURN_FAIL);
  42.  
  43.   if(XpkUnpackTags(XPK_InName, args.from, XPK_OutName, args.to,
  44.   XPK_GetError, errbuf, XPK_ChunkHook, &chunkhook, TAG_DONE))
  45.   {
  46.     STRPTR a = errbuf;
  47.     VPrintf("Can't XpkUnpack: %s\n", &a);
  48.     End(RETURN_FAIL);
  49.   }
  50.  
  51.   End(RETURN_OK);
  52. }
  53.  
  54. void end(void)
  55. {
  56.   if(XpkBase)    CloseLibrary(XpkBase);
  57.   if(rda)    FreeArgs(rda);
  58. }
  59.  
  60.