finish migrating from arosmesa to mesa3dgl
[AROS.git] / rom / dos / setcurrentdirname.c
blobd893f75bc65d1685abfd518b213125758c2003e7
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set the name of the current directory.
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include <proto/dos.h>
10 #include <dos/dos.h>
11 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/dos.h>
19 AROS_LH1(BOOL, SetCurrentDirName,
21 /* SYNOPSIS */
22 AROS_LHA(CONST_STRPTR, name, D1),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 93, Dos)
27 /* FUNCTION
28 Sets the name of the current directory in the CLI structure.
29 If the name doesn't fit the old name is kept and a failure
30 returned. If the current process doesn't have a CLI structure
31 this function does nothing.
33 INPUTS
34 name - Name for the current directory.
36 RESULT
37 !=0 on success, 0 on failure.
39 NOTES
41 EXAMPLE
43 BUGS
44 Never copies more than 255 bytes.
46 SEE ALSO
47 GetCurrentDirName()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct CommandLineInterface *cli = NULL;
56 CONST_STRPTR s;
57 STRPTR bs;
58 ULONG namelen;
60 if ((cli = Cli()) == NULL)
61 return DOSFALSE;
63 s = name;
64 while(*s++)
66 namelen = s - name - 1;
68 if (namelen > 255)
69 return DOSFALSE;
71 bs = AROS_BSTR_ADDR(cli->cli_SetName);
73 AROS_BSTR_setstrlen(cli->cli_SetName, namelen);
74 CopyMem((APTR)name, bs, namelen);
76 return DOSTRUE;
77 AROS_LIBFUNC_EXIT
78 } /* SetCurrentDirName */