2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
5 Desc: Execute a CLI command
9 #include "dos_intern.h"
10 #include <dos/dosextens.h>
11 #include <utility/tagitem.h>
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH3(LONG
, Execute
,
21 AROS_LHA(CONST_STRPTR
, string
, D1
),
22 AROS_LHA(BPTR
, input
, D2
),
23 AROS_LHA(BPTR
, output
, D3
),
26 struct DosLibrary
*, DOSBase
, 37, Dos
)
30 Execute a CLI command specified in 'string'. This string may contain
31 features you may use on the shell commandline like redirection using >,
32 < or >>. Execute() doesn't return until the command(s) that should be
33 executed are finished.
34 If 'input' is not NULL, more commands will be read from this stream
35 until end of file is reached. 'output' will be used as the output stream
36 of the commands (if output is not redirected). If 'output' is NULL the
37 current window is used for output -- note that programs run from the
38 Workbench doesn't normally have a current window.
42 string -- pointer to a NULL-terminated string with commands
44 input -- stream to use as input (may be NULL)
45 output -- stream to use as output (may be NULL)
49 Boolean telling whether Execute() could find and start the specified
50 command(s). (This is NOT the return code of the command(s).)
64 To get the right result, the function ExecCommand() (used by both Execute()
65 and SystemTagList()) uses NP_Synchronous to wait for the commands to
66 finish. This is not the way AmigaOS does it as NP_Synchronous is not
67 implemented (but defined).
69 *****************************************************************************/
74 struct TagItem tags
[] =
76 { SYS_Asynch
, FALSE
},
77 { SYS_Background
, FALSE
},
78 { SYS_Input
, (IPTR
)input
},
79 { SYS_Output
, (IPTR
)output
},
80 { SYS_Error
, (IPTR
)NULL
},
85 result
= SystemTagList(string
, tags
);