Connection command structure.
More...
#include <msh_command.h>
|
| int | execute (int in=STDIN_FILENO, int out=STDOUT_FILENO, int flags=0) |
| | Execute the command.
|
| |
|
| int | execute_conditional (int in, int out, int flags, TokenType op) |
| | Executes conditional connections, i.e. && and ||.
|
| |
| int | execute_background (int in, int out, int flags) |
| | Executes background connections, i.e. &.
|
| |
| int | execute_sequence (int in, int out, int flags) |
| | Executes sequential connections, i.e. ;.
|
| |
| int | execute_pipeline (int in, int out, int flags) |
| | Executes pipeline connections, i.e. | and |&.
|
| |
Connection command structure.
Represents a connection between two commands. Holds a Token specifying the type of connection and two command structures.
On execute() the execution is delegated to the appropriate function depending on the type of connection.
- See also
- command
-
Token
◆ execute()
| int connection_command::execute |
( |
int | in = STDIN_FILENO, |
|
|
int | out = STDOUT_FILENO, |
|
|
int | flags = 0 ) |
|
inline |
Execute the command.
- Parameters
-
| in | File descriptor to use as stdin. |
| out | File descriptor to use as stdout |
| flags | Flags to pass to the command. |
- Returns
- Exit code of the command.
Executes the left-hand side command and then the right-hand side command with respect to the type of connection.
◆ execute_background()
| int connection_command::execute_background |
( |
int | in, |
|
|
int | out, |
|
|
int | flags ) |
|
inlineprivate |
Executes background connections, i.e. &.
Executes the left-hand side command and then the right-hand side command asynchronously.
- Parameters
-
| in | File descriptor to use as stdin. |
| out | File descriptor to use as stdout |
| flags | Flags to pass to the command. |
- Returns
- Exit code of the command.
◆ execute_conditional()
| int connection_command::execute_conditional |
( |
int | in, |
|
|
int | out, |
|
|
int | flags, |
|
|
TokenType | op ) |
|
inlineprivate |
Executes conditional connections, i.e. && and ||.
If the left-hand side command returns 0 and the connection is && or if the left-hand side command returns non-zero and the connection is ||, the right-hand side command is executed.
- Parameters
-
| in | File descriptor to use as stdin. |
| out | File descriptor to use as stdout |
| flags | Flags to pass to the command. |
| op | Type of the connection. |
- Returns
- Exit code of the command.
◆ execute_pipeline()
| int connection_command::execute_pipeline |
( |
int | in, |
|
|
int | out, |
|
|
int | flags ) |
|
inlineprivate |
Executes pipeline connections, i.e. | and |&.
Executes the left-hand side command and then the right-hand side command sequentially with the output of the left-hand side command piped to the input of the right-hand side command. If the connection is |&, the standard error of the left-hand side command is also piped.
- Parameters
-
| in | File descriptor to use as stdin. |
| out | File descriptor to use as stdout |
| flags | Flags to pass to the command. |
- Returns
- Exit code of the command.
◆ execute_sequence()
| int connection_command::execute_sequence |
( |
int | in, |
|
|
int | out, |
|
|
int | flags ) |
|
inlineprivate |
Executes sequential connections, i.e. ;.
Executes the left-hand side command and then the right-hand side command sequentially.
- Parameters
-
| in | File descriptor to use as stdin. |
| out | File descriptor to use as stdout |
| flags | Flags to pass to the command. |
- Returns
- Exit code of the command.
The documentation for this struct was generated from the following file: