Fixed missing fprintf argument.
[AROS.git] / rom / dos / setprompt.c
blob730b0cc673d4fd5d4b7d571a1992931758df137c
1 /*
2 Copyright © 1995-2001, 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(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 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
54 struct CommandLineInterface *cli = NULL;
55 STRPTR s;
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 s = AROS_BSTR_ADDR(cli->cli_Prompt);
71 AROS_BSTR_setstrlen(cli->cli_Prompt, namelen);
72 CopyMem((APTR)name, s, namelen);
74 return DOSTRUE;
75 AROS_LIBFUNC_EXIT
76 } /* SetPrompt */