Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / nonvolatile / getcopynv.c
blobe7b420045c4519936c15aee66af247c14ecdcfb3
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <string.h>
7 #include <dos/dosextens.h>
8 #include <proto/exec.h>
9 #include <proto/nvdisk.h>
11 #include LC_LIBDEFS_FILE
13 /*****************************************************************************
15 NAME */
16 #include <libraries/nonvolatile.h>
18 AROS_LH3(APTR, GetCopyNV,
20 /* SYNOPSIS */
22 AROS_LHA(STRPTR, appName, A0),
23 AROS_LHA(STRPTR, itemName, A1),
24 AROS_LHA(BOOL, killRequesters, D1),
26 /* LOCATION */
28 struct Library *, nvBase, 5, Nonvolatile)
30 /* FUNCTION
32 Search the nonvolatile storage for the object 'itemName' allocated by
33 'appName' and return a copy of the data.
35 INPUTS
37 appName -- name of the application that allocated the item
38 itemName -- the object to look for
39 killRequesters -- if TRUE no system requesters will be allowed to be
40 displayed during the operation of this function
42 RESULT
44 Pointer to the data assocated with 'itemName' as allocated by 'appName'.
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 FreeNVData(), <libraries/nonvolatile.h>
56 INTERNALS
58 ******************************************************************************/
61 AROS_LIBFUNC_INIT
63 struct Process *me = (struct Process *)FindTask(NULL);
64 APTR oldReq = me->pr_WindowPtr;
65 APTR result;
67 if(appName == NULL || itemName == NULL)
68 return NULL;
70 if(strpbrk(appName, ":/") != NULL ||
71 strpbrk(itemName, ":/") != NULL)
72 return NULL;
74 if(killRequesters)
75 me->pr_WindowPtr = (APTR)-1;
77 result = ReadNVDData(appName, itemName);
79 if(killRequesters)
80 me->pr_WindowPtr = oldReq;
82 return result;
84 AROS_LIBFUNC_EXIT
85 } /* GetCopyNV */