finish migrating from arosmesa to mesa3dgl
[AROS.git] / rom / dos / setprompt.c
blobb81acac82675a55798411f3ecff4548c6c6bc178
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Sets the prompt for the current CLI.
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, SetPrompt,
21 /* SYNOPSIS */
22 AROS_LHA(CONST_STRPTR, name, D1),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 97, Dos)
27 /* FUNCTION
28 Sets the prompt in the current CLI structure. If the name doesn't
29 fit the old name is kept and a failure is returned. If the current
30 process doesn't have a CLI structure this function does nothing.
32 INPUTS
33 name - The prompt to be set.
35 RESULT
36 !=0 on success, 0 on failure.
38 NOTES
40 EXAMPLE
42 BUGS
43 Never copies more than 255 bytes.
45 SEE ALSO
46 GetPrompt()
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
53 struct CommandLineInterface *cli = NULL;
54 CONST_STRPTR s;
55 STRPTR bs;
56 ULONG namelen;
58 if ((cli = Cli()) == NULL)
59 return DOSFALSE;
61 s = name;
62 while(*s++)
64 namelen = s - name - 1;
66 if (namelen > 255)
67 return DOSFALSE;
69 bs = AROS_BSTR_ADDR(cli->cli_Prompt);
71 AROS_BSTR_setstrlen(cli->cli_Prompt, namelen);
72 CopyMem((APTR)name, bs, namelen);
74 return DOSTRUE;
75 AROS_LIBFUNC_EXIT
76 } /* SetPrompt */