2 Copyright © 2003, The AROS Development Team. All rights reserved.
6 /******************************************************************************
22 Command to unpack/unarchive AROS .pkg files.
26 NAME - The name of the file to unpack.
27 TO – The drive or path to be unpacked.
32 Standard DOS error codes.
36 This command is not a tool like lha, lzx or unzip.
37 The .pkg files are not compressed.
42 Unpack AROS.pkg TO Ram:
52 04.05.2000 SDuvan implemented
54 ******************************************************************************/
57 #include <dos/rdargs.h>
58 #include <proto/exec.h>
59 #include <proto/dos.h>
61 #define SH_GLOBAL_DOSBASE 1
62 #define SH_GLOBAL_SYSBASE 1
64 #include <aros/shcommands.h>
70 struct IntuitionBase
*IntuitionBase
;
71 struct GfxBase
*GfxBase
;
76 AROS_SHA( STRPTR
, , FILE, /A
, NULL
),
77 AROS_SHA( STRPTR
, , TO
, /A
, NULL
)
86 if( SHArg(FILE) == NULL
) goto cleanup
;
87 if( SHArg(TO
) == NULL
) goto cleanup
;
89 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary( "intuition.library", 0 );
90 GfxBase
= (struct GfxBase
*)OpenLibrary( "graphics.library", 0 );
92 //Printf( "%s, %s\n", SHArg(FILE), SHArg(TO) );
94 pkg
= PKG_Open( SHArg(FILE), MODE_READ
);
95 if( pkg
== NULL
) goto cleanup
;
97 newDir
= Lock( SHArg(TO
), SHARED_LOCK
);
98 if( newDir
== NULL
) goto cleanup
;
99 oldDir
= CurrentDir( newDir
);
101 if( !GUI_Open() ) goto cleanup
;
103 PKG_ExtractEverything( pkg
);
108 if( oldDir
!= NULL
) CurrentDir( oldDir
);
109 if( newDir
!= NULL
) UnLock( newDir
);
110 if( pkg
!= NULL
) PKG_Close( pkg
);
112 if( IntuitionBase
!= NULL
) CloseLibrary( (struct Library
*) IntuitionBase
);
113 if( GfxBase
!= NULL
) CloseLibrary( (struct Library
*) GfxBase
);