Put pciehci.device in DEVS:USBHardware, like the other host-controller
[AROS.git] / workbench / c / shellcommands / Stack.c
blobb073e3e726fa1a600eda27d9983129e27bcb9289
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Stack CLI command
6 Lang: English
7 */
9 /**************************************************************************
11 NAME
12 Stack
14 FORMAT
15 Stack [[SIZE] (stack size)]
17 SYNOPSIS
18 SIZE/N
20 LOCATION
23 FUNCTION
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.
28 EXAMPLE
30 HISTORY
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. */
49 AROS_SH1(Stack, 41.1,
50 AROS_SHA(LONG *, , SIZE,/N,NULL))
52 AROS_SHCOMMAND_INIT
54 int retval = RETURN_OK;
55 struct CommandLineInterface *cli = Cli();
58 /* We must be a Shell to do this operation */
59 if (cli == NULL)
61 return RETURN_FAIL;
64 /* Write out current stack size */
65 if (SHArg(SIZE) == NULL)
67 LONG currentstack = cli->cli_DefaultStack * CLI_DEFAULTSTACK_UNIT;
69 VPrintf("Current stack size is %ld bytes\n",
70 (IPTR *)&currentstack);
72 /* Set new stack size */
73 else
75 LONG newSize = *SHArg(SIZE);
77 if (newSize > MINIMUM_STACK_SIZE)
79 cli->cli_DefaultStack = (newSize + CLI_DEFAULTSTACK_UNIT - 1) / CLI_DEFAULTSTACK_UNIT;
81 else
83 PutStr("Requested size is too small.\n");
84 retval = RETURN_ERROR;
88 return retval;
90 AROS_SHCOMMAND_EXIT