only generate the default.properties file when we are actually doing an android build.
[AROS.git] / workbench / system / CLI.c
blob8bb639afa3c8a356669cd8a91c199813952691e3
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: 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 tooltype.
32 INPUTS
34 The attributes are read as tooltypes from the Shell icon.
36 WINDOW -- Specification of the shell window. It must be in the form
37 con:[X]/[Y]/[WIDTH]/[HEIGHT]...
39 X -- number of pixels from the left edge of
40 the screen
41 Y -- number of pixels from the top edge of
42 the screen
43 WIDTH -- width of the shell window in pixels
44 HEIGHT -- height of the shell window in pixels
45 TITLE -- text to appear in the shell window's
46 title bar
47 AUTO -- the window automatically appears when the
48 program needs input or output
49 ALT -- the window appears in the specified size
50 and position when the zoom gadget is clicked
51 BACKDROP -- the window is a backdrop window
52 CLOSE -- include a close gadget
53 INACTIVE -- the window is not made active when opened
54 NOBORDER -- the window is borderless, only the size,
55 depth and zoom gadgets are available
56 NOCLOSE -- the window has no close gadget
57 NODEPTH -- the window has no depth gadget
58 NODRAG -- the window cannot be drag; implies NOCLOSE
59 NOSIZE -- the window has no size gadget
60 SCREEN -- name of a public screen to open the window on
61 SIMPLE -- if the window is enlarged the text expands to
62 fill the available space
63 SMART -- if the window is enlarged the text will not
64 expand
65 WAIT -- the window can only be closed by selecting
66 the close gadget or entering CTRL-\.
69 FROM -- File to execute before resorting to normal shell
70 operations. If nothing is specified S:Shell-Startup
71 is used.
73 STACK -- Stack size in Bytes.
75 RESULT
77 NOTES
78 As opposed to C:NewShell, this is a Workbench Tool.
80 EXAMPLE
82 BUGS
84 SEE ALSO
86 INTERNALS
88 HISTORY
90 ******************************************************************************/
92 #include <proto/dos.h>
93 #include <proto/icon.h>
95 //#define DEBUG 1
96 #include <aros/debug.h>
98 const TEXT ver[] = "$VER:CLI 1.1 (30.11.2013) © AROS Dev Team";
100 int main(void)
102 struct DiskObject *dobj;
103 LONG rc = RETURN_FAIL;
105 dobj = GetDiskObject("PROGDIR:Shell");
106 if (dobj)
108 ULONG stack;
109 BPTR win, from;
110 STRPTR result, winspec, fromspec;
111 STRPTR *toolarray = dobj->do_ToolTypes;
113 result = FindToolType(toolarray, "STACK");
114 if (result)
115 StrToLong(result, &stack);
116 else
117 stack = AROS_STACKSIZE;
119 result = FindToolType(toolarray, "FROM");
120 if (result)
121 fromspec = result;
122 else
123 fromspec = "S:Shell-Startup";
125 result = FindToolType(toolarray, "WINDOW");
126 if (result)
127 winspec = result;
128 else
129 winspec = "CON:0/50//130/AROS-Shell/CLOSE";
131 from = Open(fromspec, MODE_OLDFILE);
132 win = Open(winspec, MODE_NEWFILE);
134 if (stack < AROS_STACKSIZE)
135 stack = AROS_STACKSIZE;
137 D(bug("[CLI] stack %d from %s window %s\n", stack, fromspec, winspec));
139 if (win)
141 struct TagItem tags[] =
143 { SYS_Asynch, TRUE },
144 { SYS_Background, FALSE },
145 { SYS_Input, (IPTR)win },
146 { SYS_Output, (IPTR)NULL },
147 { SYS_Error, (IPTR)NULL },
148 { SYS_ScriptInput, (IPTR)from },
149 { SYS_UserShell, TRUE },
150 { NP_StackSize, stack },
151 { TAG_DONE, 0 }
154 rc = SystemTagList("", tags);
155 if (rc != -1)
157 win = BNULL;
158 from = BNULL;
160 else
161 rc = RETURN_FAIL;
164 Close(win);
165 Close(from);
167 FreeDiskObject(dobj);
170 return rc;