2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Stack CLI command
9 /**************************************************************************
15 Stack [[SIZE] (stack size)]
24 Stack sets the default stack size of the current Shell. This is the
25 stack size of the commands run from the Shell. If you use Stack
26 without arguments, the current stack size will be written out.
32 1.1.2000 SDuvan implemented (yes, celebration is over -- time for
33 some hard work again -- but I might change to
34 everyday clothes first...)
36 **************************************************************************/
38 #include <exec/types.h>
39 #include <dos/dosextens.h>
40 #include <dos/rdargs.h>
41 #include <proto/dos.h>
43 #include <aros/shcommands.h>
45 #define MINIMUM_STACK_SIZE 2048 /* This is a wild guess and depends on
46 (among other things) how much stack
47 space AROS functions need. */
50 AROS_SHA(LONG
*, , SIZE
,/N
,NULL
))
54 int retval
= RETURN_OK
;
55 struct CommandLineInterface
*cli
= Cli();
58 /* We must be a Shell to do this operation */
64 /* Write out current stack size */
65 if (SHArg(SIZE
) == NULL
)
67 LONG currentstack
= cli
->cli_DefaultStack
* CLI_DEFAULTSTACK_UNIT
;
69 Printf("Current stack size is %ld bytes\n", currentstack
);
71 /* Set new stack size */
74 LONG newSize
= *SHArg(SIZE
);
76 if (newSize
> MINIMUM_STACK_SIZE
)
78 cli
->cli_DefaultStack
= (newSize
+ CLI_DEFAULTSTACK_UNIT
- 1) / CLI_DEFAULTSTACK_UNIT
;
82 PutStr("Requested size is too small.\n");
83 retval
= RETURN_ERROR
;