Check for SYS/GL during library init. Reason is that
[AROS.git] / test / exec / openlib.c
blob861614f372da1addbf7751f706e24f1dc063daac
1 /*
2 Copyright © 1995-2004 The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Tool to test openlib closelib functions.
6 Lang: english
7 */
8 #define DEBUG 1
9 #include <aros/debug.h>
11 #include <exec/memory.h>
12 #include <dos/dos.h>
13 #include <dos/exall.h>
14 #include <dos/datetime.h>
15 #include <proto/dos.h>
16 #include <proto/utility.h>
17 #include <utility/tagitem.h>
18 #include <utility/utility.h>
20 #include <proto/alib.h>
21 #include <proto/exec.h>
22 #include <proto/dos.h>
24 #include <stdio.h>
25 #include <string.h>
26 #include <stdlib.h>
28 static const char version[] __attribute__((used)) = "$VER: openlib.c 45.0 (16.1.2004)\n";
30 #define ARG_TEMPLATE "LIBRARY/A,DIRTY/S"
32 enum
34 ARG_LIBNAME,
35 ARG_DIRTY,
36 NOOFARGS
39 int main(int argc, char **argv)
41 IPTR args[NOOFARGS] = {0, // ARG_LIBNAME
42 FALSE // ARG_DIRTY
44 struct RDArgs *rda;
45 rda = ReadArgs(ARG_TEMPLATE, args, NULL);
46 if (NULL != rda)
48 if (args[ARG_LIBNAME]!=0)
50 APTR tmpBase = OpenLibrary((CONST_STRPTR) args[ARG_LIBNAME],0);
51 if (tmpBase != 0)
53 printf ("OPENLIB.c: Succesfully opened !\n");
55 if (args[ARG_DIRTY] == FALSE)
57 CloseLibrary(tmpBase);
58 printf ("OPENLIB.c: Library closed\n");
61 }else{
62 printf("OPENLIB.c: Library open FAILED!\n");
64 }else{
65 printf("OPENLIB.c: Please specify a library to open!\n");
67 FreeArgs(rda);
69 return 0;