.TH "FBB::Exec" "3bobcat" "2005\-2024" "libbobcat\-dev_6\&.06\&.02" "Executing Child Processes" .PP .SH "NAME" FBB::Exec \- Runs external programs .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" The \fBFBB::Exec\fP class offers a basic interface for calling external programs (so\-called \fIchild processes\fP)\&. The standard streams of the child processes are not handled by \fIExec\fP objects: the parent\(cq\&s standard streams are used by the child process\&. The \fIPATH\fP environment variable is not used when calling child processes: child process programs must be specified using paths\&. .PP \fIExec\fP objects may repeatedly be used to execute the same or different child processes\&. Before starting the next child process, the current child process must have finished\&. .PP Arguments passed to child processes may be surrounded by double or single quotes\&. Arguments surrounded by double quotes have their double quotes removed, while interpreting any escape\-sequences that may have been used within\&. Arguments surrounded by single quotes have their single quotes removed, while accepting their content as\-is\&. In addition unquoted escape\-sequences may be specified: those escape sequences are evaluated and replaced by their intended characters (e\&.g\&., \fI\e100\fP is converted to \fI@\fP)\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \fBFBB::Fork\fP .PP .SH "CONSTRUCTOR" .PP Only the default constructor is supported\&. .PP .SH "MEMBERS" .PP .IP o \fBbool execute(std::string const &cmd)\fP: .br The argument specifies the command to execute: the command itself must be specified as a path (the \fIPATH\fP environment variable isn\(cq\&t used)\&. The member returns \fItrue\fP if the child process\(cq\&s exit value equals 0\&. Otherwise \fIfalse\fP is returned\&. Once \fIexecute\fP has returned it can be called again, either using the same or another command\&. The class \fIExec\fP does not offer facilities to forcefully terminate child processes: parent processes are suspended until the child processes have completed\&. Arguments passed to the program to be executed as child process may optionall be specified using single or double quotes, as described in this man\-page\(cq\&s DESCRIPTION section\&. .IP .IP o \fBint ret() const\fP: .br Once \fIexecute\fP has returned this member provides the actual exit code of the child process\&. Its value equals \-1 before the first \fIexectue\fP call\&. .PP .SH "EXAMPLE" .PP .nf #include #include using namespace std; using namespace FBB; int main() { ExecFork ef; if (ef\&.execute(\(dq\&/bin/cp driver\&.cc /tmp\(dq\&)) cout << \(dq\&driver\&.cc now copied to /tmp\en\(dq\&; else cout << \(dq\&could not copy driver\&.cc to /tmp\en\(dq\&; cout << \(dq\&Again:\en\(dq\&; if (ef\&.execute(\(dq\&/bin/cp driver\&.cc /tmp\(dq\&)) cout << \(dq\&driver\&.cc now copied to /tmp\en\(dq\&; else cout << \(dq\&could not copy driver\&.cc to /tmp\en\(dq\&; } .fi .PP .SH "FILES" \fIbobcat/exec\fP \- provides the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBcerrextractor\fP(3bobcat), \fBcininserter\fP(3bobcat), \fBcoutextractor\fP(3bobcat), \fBexecl\fP(3), \fBfork\fP(3bobcat), \fBprocess\fP(3bobcat), \fBstdextractor\fP(3bobcat)\&. .PP .SH "BUGS" None reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.06\&.02\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.06\&.02\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.06\&.02\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.06\&.02\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.06\&.02\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP