Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / getprompt.c
blobb38fc86225ccf77314a21d60981285a14c66110a
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get the current prompt.
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, GetPrompt,
20 /* SYNOPSIS */
21 AROS_LHA(STRPTR, buf, D1),
22 AROS_LHA(LONG , len, D2),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 98, Dos)
27 /* FUNCTION
28 Copies the prompt from the CLI structure into the buffer. If the
29 buffer is too small the name is truncated, and a failure is returned.
30 If the current process doesn't have a CLI structure, a 0 length string
31 is put into the buffer and a failure is returned.
33 INPUTS
34 buf - Buffer for the prompt.
35 len - Size of the buffer in bytes.
37 RESULT
38 !=0 on success, 0 on failure. IoErr() gives additional information
39 in that case.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 SetPrompt()
50 INTERNALS
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
55 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
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_Prompt);
72 clen = (ULONG)AROS_BSTR_strlen(cli->cli_Prompt);
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 } /* GetPrompt */