/usr/share/doc/libbobcat4-dev/man/cininserter.3.html is in libbobcat-dev 4.08.02-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::CinInserter(3bobcat)</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
.XXfc {margin-left:auto;margin-right:auto;}
.XXtc {text-align: center;}
.XXtl {text-align: left;}
.XXtr {text-align: right;}
.XXvt {vertical-align: top;}
.XXvb {vertical-align: bottom;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title">FBB::CinInserter(3bobcat)</h1>
<h2 id="author">Executing Child Processes<br/>(libbobcat-dev_4.08.02-x.tar.gz)</h2>
<h2 id="date">2005-2017</h2>
<p>
<h2 >NAME</h2>FBB::CinInserter - Runs external programs reading standard input
<p>
<h2 >SYNOPSIS</h2>
<strong >#include <bobcat/cininserter></strong><br/>
Linking option: <em >-lbobcat</em>
<p>
<h2 >DESCRIPTION</h2>
The <strong >FBB::CinInserter</strong> class offers a basic interface for calling
external programs (so-called child processes) reading their standard input
streams. The standard output and standard error streams of the child processes
by default are not handled by ttCinInserter) objects. The child's standard
input is provided through the <em >CinInserter</em> object: information inserted
into an <em >CinInserter</em> object is forwarded to the child process's standard
input stream. The <em >PATH</em> environment variable is not used when calling child
processes: child process programs must be specified using paths.
<p>
<em >CinInserter</em> 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.
<p>
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 contents as-is. In addition unquoted
escape-sequences may be specified: those escape sequences are evaluated and
replaced by their intended characters (e.g., <em >\100</em> is converted to <em >@</em>).
<p>
When information of undetermined size or structure must be inserted into a
child process then the child process cannot determine when to stop. This
creates an interesting problem: the child process starts, and the parent
process must wait until its child process has finished processing its
input. But input can only be forwarded to the child's input stream after the
child process has started. To solve this problem <em >InterterFork</em> offers an
overloaded <em >execute</em> member, passing information to the child process via a
separate thread.
<p>
<h2 >NAMESPACE</h2>
<strong >FBB</strong><br/>
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace <strong >FBB</strong>.
<p>
<h2 >INHERITS FROM</h2>
<strong >FBB::Exec</strong> (private),
<strong >FBB::OFdStreambuf</strong> (private),
<strong >std::ostream</strong>.
<p>
<h2 >CONSTRUCTOR</h2>
<p>
<ul>
<li> <strong >CinInserter(size_t bufSize = 100)</strong>:<br/>
A <em >bufSize</em> argument may be specified: it defines the internal buffer
size used by the <em >CinInserter's</em> streambuf. By default the stdandard
output and standard error streams are not handled.
<li> <strong >CinInserter(Mode mode, size_t bufSize = 100)</strong>:<br/>
The <em >mode</em> argument must be <em >CinInserter::CLOSE_STD</em>. It indicates
that the standard output and standard error streams are redirected to
<em >/dev/null</em>: any standard output generated by child processes is
ignored. A <em >bufSize</em> argument may be specified: it defines the
internal buffer size used by the <em >CinInserter's</em> streambuf.
</ul>
<p>
<h2 >DESTRUCTOR</h2>
<p>
The destructor ends the <em >CinInserter's</em> child process, if it is still
active.
<p>
<h2 >MEMBERS</h2>
<p>
<ul>
<li> <strong >void execute(std::string const &cmd)</strong>:<br/>
The argument specifies the command to execute: the command itself must
be specified as a path (the <em >PATH</em> environment variable isn't used).
This member immediately returns, after which
information can be inserted into the <em >CinInserter</em> object which is then
forwarded to the childprocess's standard input stream.
<p>
Once all information has been inserted, the child process's standard input
stream must be closed. This is realized by either calling <em >stop</em> or by
calling <em >execute</em> once again, or by ending the <em >CinInserter</em> object's
lifetime.
<p>
Arguments specified in the <em >cmd</em> string are passed to the child process, and
may optionally be specified using single or double quotes, as described in
this man-page's DESCRIPTION section.
<p>
<li> <strong >bool execute(std::string const &cmd, std::string const &text)</strong>:<br/>
This member is used to forward a limited amount of information
(contained in the <em >text</em> parameter) to the child process specified at
<em >cmd</em> (defined identically as the <em >cmd</em> parameter of the previous
<em >execute</em> member).
<p>
This member returns <em >true</em> if the child process's exit value equals 0.
<p>
<li> <strong >int stop()</strong>:<br/>
This function can be called after all information has been inserted
into the <em >CinInserter</em> object to close the child process's standard input
stream. It is not required after calling <em >execute(cmd, text)</em>, or when
calling <em >execute</em> again, or when the <em >CinInseror</em> object's lifetime ends.
<p>
This member returns the exit code of the last executed child process,
which may also be obtained from the next member:
<p>
<li> <strong >int ret() const</strong>:<br/>
Once a child process has finished this member provides the actual exit
code of the child process. Its value equals -1 before the first <em >exectue</em>
call.
</ul>
<p>
<h2 >PROTECTED MEMBER</h2>
<p>
<ul>
<li> <strong >Pipe &childInPipe()</strong>:<br/>
If derived classes need to override the redirections-members then they
probabaly need access to the pipe read by the child process. This
member provides a reference to that pipe. By default the parent
process inserts information into the pipe, while the
child process reads the inserted information from the pipe.
</ul>
<p>
<h2 >EXAMPLE</h2>
<p>
<pre >
//#include <bobcat/cininserter>
#include "../cininserter"
#include <iostream>
#include <fstream>
using namespace std;
using namespace FBB;
int main()
{
CinInserter inserter;
inserter.execute("/bin/cat");
ifstream in("build");
inserter << in.rdbuf();
cout << "child returns: " << inserter.stop() << '\n';
inserter.execute("/bin/cat");
in.seekg(0); // reset to the beginning
inserter << in.rdbuf();
// when immediately followed by another execute, 'stop' is optional
inserter.execute("/bin/cat", "a simple text\n");
inserter.execute("/bin/cat", "a simple text\n");
bool bret = inserter.execute("/bin/cat", "a simple text\n");
cout << "direct string insertion: " << bret << '\n';
}
</pre>
<p>
<h2 >FILES</h2>
<em >bobcat/cininserter</em> - provides the class interface
<p>
<h2 >SEE ALSO</h2>
<strong >bobcat</strong>(7), <strong >cerrextractor</strong>(3bobcat), <strong >coutextractor</strong>(3bobcat),
<strong >execl</strong>(3), <strong >exec</strong>(3bobcat),
<strong >fork</strong>(3bobcat), <strong >pipe</strong>(3bobcat), <strong >process</strong>(3bobcat),
<strong >stdextractor</strong>(3bobcat).
<p>
<h2 >BUGS</h2>
None reported.
<p>
<h2 >DISTRIBUTION FILES</h2>
<ul>
<li> <em >bobcat_4.08.02-x.dsc</em>: detached signature;
<li> <em >bobcat_4.08.02-x.tar.gz</em>: source archive;
<li> <em >bobcat_4.08.02-x_i386.changes</em>: change log;
<li> <em >libbobcat1_4.08.02-x_*.deb</em>: debian package holding the
libraries;
<li> <em >libbobcat1-dev_4.08.02-x_*.deb</em>: debian package holding the
libraries, headers and manual pages;
<li> <em >http://sourceforge.net/projects/bobcat</em>: public archive location;
</ul>
<p>
<h2 >BOBCAT</h2>
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
<p>
<h2 >COPYRIGHT</h2>
This is free software, distributed under the terms of the
GNU General Public License (GPL).
<p>
<h2 >AUTHOR</h2>
Frank B. Brokken (<strong >f.b.brokken@rug.nl</strong>).
<p>
</body>
</html>
|