home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
packery
/
xpk_source
/
xpkmaster
/
sublibs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-19
|
1KB
|
61 lines
#ifndef XPKMASTER_SUBLIBS_C
#define XPKMASTER_SUBLIBS_C
/* Routinesheader
Name: sublibs.c
Main: xpkmaster
Versionstring: $VER: sublibs.c 1.0 (09.10.96)
Author: SDI
Distribution: PD
Description: Handling of xpksublibraries
1.0 09.10.96 : first real version
*/
#include <pragma/exec_lib.h>
#include <exec/types.h>
#include <dos/dos.h>
#include "xpkmaster.h"
#include "xpk_strings.h"
/************************* open sublib from ID ***************************/
struct Library *opensub(struct XpkBuffer *xbuf, ULONG ID)
{
UBYTE libname[] = "compressors/xpk____.library";
struct Library *XpkSubBase;
/* Do nothing if we already have what we want */
if((xbuf->xb_SubBase) && (xbuf->xb_SubID == ID))
return xbuf->xb_SubBase;
closesub(xbuf);
xbuf->xb_SubID = ID;
CopyMem((STRPTR) &ID, libname+15, 4);
if(!(XpkSubBase = OpenLibrary(libname, 0)))
{
xbuf->xb_Result = XPKERR_MISSINGLIB;
sprintf(xbuf->xb_ErrMsg, strings[FMT_CANNOT_OPEN_SUBLIB], libname);
}
else if((xbuf->xb_SubInfo = XpksPackerInfo())->xi_MasterVersion > MainVersion)
{
xbuf->xb_Result = XPKERR_OLDMASTLIB;
closesub(xbuf);
}
return(xbuf->xb_SubBase = XpkSubBase);
}
/*********************** close any open sub-library *********************/
void closesub(struct XpkBuffer *xbuf)
{
if(xbuf->xb_SubBase)
{
CloseLibrary(xbuf->xb_SubBase);
xbuf->xb_SubBase = NULL;
}
}
#endif /* XPKMASTER_SUBLIBS_C */