Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / nonvolatile / nvdisk / setnvdprotection.c
blob3a9c0af84a4170d5c85c3a1c6af3840eab1cd07b
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME */
13 #include "nvdisk_intern.h"
14 #include <dos/dos.h>
15 #include <proto/dos.h>
16 #include <libraries/nonvolatile.h>
19 AROS_LH3(BOOL, SetNVDProtection,
21 /* SYNOPSIS */
23 AROS_LHA(STRPTR, appName, A0),
24 AROS_LHA(STRPTR, itemName, A1),
25 AROS_LHA(LONG, mask, D0),
27 /* LOCATION */
29 struct Library *, nvdBase, 9, NVDisk)
31 /* FUNCTION
33 Protect an item saved in nonvolatile memory.
35 INPUTS
37 appName -- the application owning the item
38 itemName -- the item to protect
39 mask -- protection status to inflict
41 RESULT
43 The memory item 'itemName' will be protected as specified by the 'mask'.
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
53 INTERNALS
55 HISTORY
57 April 2000, SDuvan -- implemented
59 ******************************************************************************/
62 AROS_LIBFUNC_INIT
64 BPTR lock;
65 BOOL result = FALSE;
66 BPTR oldCDir = CurrentDir(GPB(nvdBase)->nvd_location);
68 if((lock = Lock(appName, SHARED_LOCK)) != BNULL)
70 result = SetProtection(itemName, mask) == DOSTRUE ? TRUE : FALSE;
72 UnLock(lock);
75 CurrentDir(oldCDir);
77 return result;
79 AROS_LIBFUNC_EXIT
80 } /* SetProtection */