2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 Desc: NewShell CLI Command
9 /******************************************************************************
26 Create a new shell in a new console window. This window will become
27 the active one. The new shell inherits most attributes of the parent
28 shell like the current directory, stack size, prompt and so on.
29 However, it is completely independent of the parent shell.
30 The window belonging to the new shell may be specified by
31 using the WINDOW keyword.
35 WINDOW -- Specification of the shell window
37 X -- number of pixels from the left edge of
39 Y -- number of pixels from the top edge of
41 WIDTH -- width of the shell window in pixels
42 HEIGHT -- height of the shell window in pixels
43 TITLE -- text to appear in the shell window's
45 AUTO -- the window automatically appears when the
46 program needs input or output
47 ALT -- the window appears in the specified size
48 and position when the zoom gadget is clicked
49 BACKDROP -- the window is a backdrop window
50 CLOSE -- include a close gadget
51 INACTIVE -- the window is not made active when opened
52 NOBORDER -- the window is borderless, only the size,
53 depth and zoom gadgets are available
54 NOCLOSE -- the window has no close gadget
55 NODEPTH -- the window has no depth gadget
56 NODRAG -- the window cannot be drag; implies NOCLOSE
57 NOSIZE -- the window has no size gadget
58 SCREEN -- name of a public screen to open the window on
59 SIMPLE -- if the window is enlarged the text expands to
60 fill the available space
61 SMART -- if the window is enlarged the text will not
63 WAIT -- the window can only be closed by selecting
64 the close gadget or entering CTRL-\.
67 FROM -- File to execute before resorting to normal shell
68 operations. If nothing is specified S:Shell-Startup
77 NewShell "CON:10/10/640/480/My own shell/CLOSE"
87 ******************************************************************************/
89 #include <exec/memory.h>
90 #include <proto/exec.h>
91 #include <proto/dos.h>
92 #include <dos/dosextens.h>
93 #include <dos/dostags.h>
94 #include <aros/asmcall.h>
97 #include <aros/shcommands.h>
99 AROS_SH3(NewShell
, 41.2,
100 AROS_SHA(STRPTR
, ,WINDOW
, ,"CON:10/50/640/480/AROS-Shell/CLOSE"),
101 AROS_SHA(STRPTR
, ,FROM
, ,"S:Shell-Startup"),
102 AROS_SHA(LONG
*, ,STACK
,/N
,NULL
))
106 BPTR from
= Open(SHArg(FROM
), MODE_OLDFILE
);
107 BPTR win
= Open(SHArg(WINDOW
), MODE_OLDFILE
);
108 LONG
*stackp
= SHArg(STACK
);
111 LONG rc
= RETURN_FAIL
;
113 if (stackp
== NULL
|| *stackp
< AROS_STACKSIZE
)
114 stack
= AROS_STACKSIZE
;
120 struct TagItem tags
[] =
122 { SYS_Asynch
, TRUE
},
123 { SYS_Background
, FALSE
},
124 { SYS_Input
, (IPTR
)win
},
125 { SYS_Output
, (IPTR
)NULL
},
126 { SYS_Error
, (IPTR
)NULL
},
127 { SYS_ScriptInput
, (IPTR
)from
},
128 { SYS_UserShell
, TRUE
},
129 { NP_StackSize
, stack
},
133 rc
= SystemTagList("", tags
);
144 PrintFault(IoErr(), "NewShell");