prism2.device: Compiler delint
[AROS.git] / workbench / system / CLI.c
blob495c81c29abc676ecf4430405ae2f5af78f2a118
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: NewShell CLI Command
6 Lang: English
7 */
9 /******************************************************************************
12 NAME
14 CLI
16 SYNOPSIS
18 WINDOW,FROM,STACK
20 LOCATION
22 SYS:System/
24 FUNCTION
26 Create a new shell in a new console window. This window will become
27 the active one.
29 The window belonging to the new shell may be specified by
30 using the WINDOW keyword.
32 INPUTS
34 WINDOW -- Specification of the shell window
36 X -- number of pixels from the left edge of
37 the screen
38 Y -- number of pixels from the top edge of
39 the screen
40 WIDTH -- width of the shell window in pixels
41 HEIGHT -- height of the shell window in pixels
42 TITLE -- text to appear in the shell window's
43 title bar
44 AUTO -- the window automatically appears when the
45 program needs input or output
46 ALT -- the window appears in the specified size
47 and position when the zoom gadget is clicked
48 BACKDROP -- the window is a backdrop window
49 CLOSE -- include a close gadget
50 INACTIVE -- the window is not made active when opened
51 NOBORDER -- the window is borderless, only the size,
52 depth and zoom gadgets are available
53 NOCLOSE -- the window has no close gadget
54 NODEPTH -- the window has no depth gadget
55 NODRAG -- the window cannot be drag; implies NOCLOSE
56 NOSIZE -- the window has no size gadget
57 SCREEN -- name of a public screen to open the window on
58 SIMPLE -- if the window is enlarged the text expands to
59 fill the available space
60 SMART -- if the window is enlarged the text will not
61 expand
62 WAIT -- the window can only be closed by selecting
63 the close gadget or entering CTRL-\.
66 FROM -- File to execute before resorting to normal shell
67 operations. If nothing is specified S:Shell-Startup
68 is used.
70 STACK -- Stack size
72 RESULT
74 NOTES
75 As opposed to C:NewShell, this is a Workbench Tool.
77 EXAMPLE
79 BUGS
81 SEE ALSO
83 INTERNALS
85 HISTORY
87 ******************************************************************************/
89 #include <aros/debug.h>
90 #include <clib/alib_protos.h>
92 #include <exec/memory.h>
93 #include <proto/exec.h>
94 #include <proto/dos.h>
95 #include <dos/dosextens.h>
96 #include <dos/dostags.h>
97 #include <aros/asmcall.h>
98 #include <string.h>
99 #include <workbench/startup.h>
101 int main(int argc, char **argv)
103 UBYTE **tt;
104 LONG rc = RETURN_FAIL;
106 tt = ArgArrayInit(argc, (UBYTE **)argv);
107 if (tt) {
108 ULONG stack;
109 BPTR win, from;
111 stack = ArgInt(tt, "STACK", AROS_STACKSIZE);
112 from = Open(ArgString(tt, "FROM", "S:Shell-Startup"), MODE_OLDFILE);
113 win = Open(ArgString(tt, "WINDOW", "CON:0/50//130/AROS-Shell/CLOSE"), MODE_NEWFILE);
115 if (stack < AROS_STACKSIZE)
116 stack = AROS_STACKSIZE;
118 if (win)
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 },
130 { TAG_DONE, 0 }
133 rc = SystemTagList("", tags);
134 if (rc != -1)
136 win = BNULL;
137 from = BNULL;
139 else
140 rc = RETURN_FAIL;
143 Close(win);
144 Close(from);
146 ArgArrayDone();
149 return rc;