Update to lasso handling. Adjust scroll amount based on difference between mouse...
[AROS.git] / rom / dos / getprompt.c
bloba1bb31137ea1c6e9ab9ffea9b08ae666ee3ad55d
1 /*
2 Copyright © 1995-2007, 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
56 struct Process *me = (struct Process *)FindTask(NULL);
57 struct CommandLineInterface *cli = BADDR(me->pr_CLI);
58 STRPTR cname;
59 ULONG clen;
60 BOOL ret = DOSTRUE;
62 if (cli == NULL)
64 if (len >= 1)
65 buf[0] = '\0';
66 me->pr_Result2 = ERROR_OBJECT_WRONG_TYPE;
67 return DOSFALSE;
70 cname = AROS_BSTR_ADDR(cli->cli_Prompt);
71 clen = (ULONG)AROS_BSTR_strlen(cli->cli_Prompt);
72 if (clen >= (len-1))
74 clen = len-1;
75 me->pr_Result2 = ERROR_LINE_TOO_LONG;
76 ret = DOSFALSE;
78 CopyMem(cname, buf, clen);
79 buf[clen] = '\0';
81 return ret;
82 AROS_LIBFUNC_EXIT
83 } /* GetPrompt */