Added kernel module for starting the usb stack at boot time. It's not activated thoug...
[cake.git] / rom / dos / getcurrentdirname.c
blob89079a3fdd1f7b8da31532e66f673118b16ca48c
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get the name of the current directory.
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include <dos/dos.h>
10 #include "dos_intern.h"
11 #include <string.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH2(BOOL, GetCurrentDirName,
20 /* SYNOPSIS */
21 AROS_LHA(STRPTR, buf, D1),
22 AROS_LHA(LONG , len, D2),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 94, Dos)
27 /* FUNCTION
28 Copies the name of the current directory from the CLI structure
29 into the buffer. If the buffer is too small the name is truncated,
30 and a failure is returned. If the current process doesn't have
31 a CLI structure, a 0 length string is put into the buffer and a
32 failure is returned.
34 INPUTS
35 buf - Buffer for the name.
36 len - Size of the buffer in bytes.
38 RESULT
39 !=0 on success, 0 on failure. IoErr() gives additional information
40 in that case.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 SetCurrentDirName()
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Process *me = (struct Process *)FindTask(NULL);
58 struct CommandLineInterface *cli = BADDR(me->pr_CLI);
59 STRPTR cname;
60 ULONG clen;
61 BOOL ret = DOSTRUE;
63 if (cli == NULL)
65 if (len >= 1)
66 buf[0] = '\0';
67 me->pr_Result2 = ERROR_OBJECT_WRONG_TYPE;
68 return DOSFALSE;
71 cname = AROS_BSTR_ADDR(cli->cli_SetName);
72 clen = (ULONG)AROS_BSTR_strlen(cli->cli_SetName);
73 if (clen >= (len-1))
75 clen = len-1;
76 me->pr_Result2 = ERROR_LINE_TOO_LONG;
77 ret = DOSFALSE;
79 CopyMem(cname, buf, clen);
80 buf[clen] = '\0';
82 return ret;
83 AROS_LIBFUNC_EXIT
84 } /* GetCurrentDirName */