muimaster.library: remove empty Dispose from Listview
[AROS.git] / workbench / libs / nonvolatile / storenv.c
blobb3bf203169ec91b30be104abb6f6f3fe7c0853b5
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <dos/dosextens.h>
8 #include <proto/exec.h>
9 #include <proto/nvdisk.h>
11 #include <string.h>
13 #include LC_LIBDEFS_FILE
15 /*****************************************************************************
17 NAME */
18 #include <libraries/nonvolatile.h>
20 AROS_LH5(LONG, StoreNV,
22 /* SYNOPSIS */
24 AROS_LHA(STRPTR, appName, A0),
25 AROS_LHA(STRPTR, itemName, A1),
26 AROS_LHA(APTR, data, A2),
27 AROS_LHA(ULONG, length, D0),
28 AROS_LHA(BOOL, killRequesters, D1),
30 /* LOCATION */
32 struct Library *, nvBase, 7, Nonvolatile)
34 /* FUNCTION
36 Save data in the nonvolatile storage.
38 INPUTS
40 appName -- the application to save an item in the nonvolatile
41 storage
42 itemName -- the name of the item to save
43 data -- the data to save
44 length -- number of tens of bytes of the data to save rounded
45 upwards (for instance to save 24 bytes specify 3).
46 killRequesters -- if TRUE no system requesters will be displayed during
47 the operation of this function
49 RESULT
51 Indication of the success of the operation
53 0 -- no error
54 NVERR_BADNAME -- 'appName' or 'itemName' were not correctly
55 specified names
56 NVERR_WRITEPROT -- the nonvolatile storage is read only
57 NVERR_FAIL -- failure in data saving (storage is full or write
58 protected)
59 NVERR_FATAL -- fatal error (possible loss of previously saved
60 data)
62 NOTES
64 The strings 'appName' and 'itemName' should be descripive but short as the
65 size of the nonvolatile storage may be very limited. The strings may not
66 contatin the characters ':' or '/'. The maximum length for each of these
67 strings is 31.
69 EXAMPLE
71 BUGS
73 SEE ALSO
75 GetCopyNV(), GetNVInfo()
77 INTERNALS
79 ******************************************************************************/
82 AROS_LIBFUNC_INIT
84 struct Process *me = (struct Process *)FindTask(NULL);
85 APTR oldReq = me->pr_WindowPtr;
86 LONG retval;
88 if(data == NULL)
89 return NVERR_FAIL; /* There is no good (defined) error to
90 report... */
92 if(appName == NULL || itemName == NULL)
93 return NVERR_BADNAME;
95 if(strpbrk(appName, ":/") != NULL ||
96 strpbrk(itemName, ":/") != NULL)
97 return NVERR_BADNAME;
99 if(killRequesters)
100 me->pr_WindowPtr = (APTR)-1;
102 // kprintf("Calling writedata");
104 retval = WriteNVDData(appName, itemName, data, length*10);
106 if(killRequesters)
107 me->pr_WindowPtr = oldReq;
109 return retval;
111 AROS_LIBFUNC_EXIT
112 } /* StoreNV */