Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / c / shellcommands / NewShell.c
blob69726b942c88b42b745275f9dee5f1c206be9ddf
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 NewShell
16 SYNOPSIS
18 WINDOW,FROM
20 LOCATION
22 Workbench:C
24 FUNCTION
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.
33 INPUTS
35 WINDOW -- Specification of the shell window
37 X -- number of pixels from the left edge of
38 the screen
39 Y -- number of pixels from the top edge of
40 the screen
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
44 title bar
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
62 expand
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
69 is used.
71 RESULT
73 NOTES
75 EXAMPLE
77 NewShell "CON:10/10/640/480/My own shell/CLOSE"
79 BUGS
81 SEE ALSO
83 INTERNALS
85 HISTORY
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 <dos/filesystem.h>
95 #include <aros/asmcall.h>
96 #include <string.h>
98 #include <aros/shcommands.h>
100 AROS_SH2(NewShell, 41.1,
101 AROS_SHA(STRPTR, ,WINDOW, ,"CON:10/20/640/480/AROS-Shell/CLOSE"),
102 AROS_SHA(STRPTR, ,FROM, ,"S:Shell-Startup"))
104 AROS_SHCOMMAND_INIT
106 BPTR from = Open(SHArg(FROM), FMF_READ);
107 BPTR win = Open(SHArg(WINDOW), FMF_READ);
109 LONG rc = RETURN_FAIL;
112 if (win)
114 struct TagItem tags[] =
116 { SYS_Asynch, TRUE },
117 { SYS_Background, FALSE },
118 { SYS_Input, (IPTR)win },
119 { SYS_Output, (IPTR)NULL },
120 { SYS_Error, (IPTR)NULL },
121 { SYS_ScriptInput, (IPTR)from },
122 { SYS_UserShell, TRUE },
123 { TAG_DONE, 0 }
126 rc = SystemTagList("", tags);
127 if (rc != -1)
129 win = NULL;
130 from = NULL;
132 else
133 rc = RETURN_FAIL;
135 else
137 PrintFault(IoErr(), "NewShell");
140 Close(win);
141 Close(from);
143 return rc;
145 AROS_SHCOMMAND_EXIT