2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Sets the name of the current program.
8 #include <proto/exec.h>
11 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
18 #include <proto/dos.h>
20 AROS_LH1(BOOL
, SetProgramName
,
23 AROS_LHA(STRPTR
, name
, D1
),
26 struct DosLibrary
*, DOSBase
, 95, Dos
)
29 Sets the name for the current program in the CLI structure. If the
30 name doesn't fit the old name is kept and a failure is returned.
31 If the current process doesn't have a CLI structure this function
35 name -- Name for the current program.
38 != 0 on success, 0 on failure.
45 Never copies more than 255 bytes.
52 *****************************************************************************/
55 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
57 return internal_SetProgramName(Cli(), name
, DOSBase
) ? DOSTRUE
: DOSFALSE
;
60 } /* SetProgramName */
63 BOOL
internal_SetProgramName(struct CommandLineInterface
*cli
, STRPTR name
,
64 struct DosLibrary
*DOSBase
)
79 namelen
= s
- name
- 1;
86 s
= AROS_BSTR_ADDR(cli
->cli_CommandName
);
88 AROS_BSTR_setstrlen(cli
->cli_CommandName
, namelen
);
89 CopyMem((APTR
)name
, s
, namelen
);