myshell 2.0.0
Loading...
Searching...
No Matches
redirectee Struct Reference

Structure representing a single redirectee. More...

#include <msh_redirect.h>

Public Member Functions

int open_redirect (std::vector< int > *fd_to_close, int flags, int mode) const
 Opens the redirection target.
 

Public Attributes

int fd = -1
 
std::string path
 

Detailed Description

Structure representing a single redirectee.

Holds either a file descriptor or a path to a file.

See also
redirect

Member Function Documentation

◆ open_redirect()

int redirectee::open_redirect ( std::vector< int > * fd_to_close,
int flags,
int mode ) const
inline

Opens the redirection target.

If the redirectee is a file descriptor, it is returned. If the redirectee is a path, it is opened and the file descriptor pointing to it is returned and added to fd_to_close.

Parameters
fd_to_closeA vector of file descriptors to close.
flagsFlags to pass to open(2).
modeMode to pass to open(2).
Returns
The file descriptor of the redirectee or -1 on error.

The documentation for this struct was generated from the following file: