added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / rom / dos / setprompt.c
blob283e09a2428118416eb01b593600158e6270590a
1 /*
2 Copyright © 1995-2007, 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 struct CommandLineInterface *cli = NULL;
54 STRPTR s;
55 ULONG namelen;
57 if ((cli = Cli()) == NULL)
58 return DOSFALSE;
60 s = name;
61 while(*s++)
63 namelen = s - name - 1;
65 if (namelen > 255)
66 return DOSFALSE;
68 s = AROS_BSTR_ADDR(cli->cli_Prompt);
70 AROS_BSTR_setstrlen(cli->cli_Prompt, namelen);
71 CopyMem((APTR)name, s, namelen);
73 return DOSTRUE;
74 AROS_LIBFUNC_EXIT
75 } /* SetPrompt */