tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / dos / setcomment.c
blob28f6fdc1e884909873ddf6cfe372365fcc6d97a5
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set a filecomment.
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <proto/exec.h>
11 #include <dos/dosextens.h>
12 #include <dos/dos.h>
13 #include <proto/dos.h>
14 #include "dos_intern.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/dos.h>
21 AROS_LH2(LONG, SetComment,
23 /* SYNOPSIS */
24 AROS_LHA(CONST_STRPTR, name, D1),
25 AROS_LHA(CONST_STRPTR, comment, D2),
27 /* LOCATION */
28 struct DosLibrary *, DOSBase, 30, Dos)
30 /* FUNCTION
31 Change the comment on a file or directory. The comment may be any
32 NUL-terminated string. The supported size varies from filesystem
33 to filesystem. In order to clear an existing comment, an empty
34 string should be specified.
36 INPUTS
37 name - name of the file
38 comment - new comment for the file.
40 RESULT
41 Boolean success indicator. IoErr() gives additional information upon
42 failure.
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 struct PacketHelperStruct phs;
59 LONG status = DOSFALSE;
61 D(bug("[SetComment] '%s' '%s'\n", name, comment));
62 if (strlen(comment)>MAXCOMMENTLENGTH)
64 SetIoErr(ERROR_COMMENT_TOO_BIG);
65 return status;
67 if (getpacketinfo(DOSBase, name, &phs)) {
68 BSTR com = C2BSTR(comment);
69 if (com) {
70 status = dopacket4(DOSBase, NULL, phs.port, ACTION_SET_COMMENT, (SIPTR)NULL, phs.lock, phs.name, com);
71 FREEC2BSTR(com);
72 } else {
73 SetIoErr(ERROR_NO_FREE_STORE);
75 freepacketinfo(DOSBase, &phs);
78 return status;
80 AROS_LIBFUNC_EXIT
81 } /* SetComment */