libassa 3.5.1
Loading...
Searching...
No Matches
Pipe.cpp
Go to the documentation of this file.
1// -*- c++ -*-
2//------------------------------------------------------------------------------
3// $Id: Pipe.cpp,v 1.5 2006/07/20 02:30:54 vlg Exp $
4//------------------------------------------------------------------------------
5// Pipe.cpp
6//------------------------------------------------------------------------------
7// Copyright (c) 1997-2002,2005 by Vladislav Grinchenko
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Library General Public
11// License as published by the Free Software Foundation; either
12// version 2 of the License, or (at your option) any later version.
13//------------------------------------------------------------------------------
14//
15// Pipe class is based on ./unixsysdevel-734/homework3/src/bin/pipe/pipe.c
16// code I wrote for UNIX system development class of JohnsHopking
17// part time engineering school in November 1997.
18// The class implementation is a rip off of Stevens' popen ()/ pclose()
19// function, p. 438.
20//
21//------------------------------------------------------------------------------
22
23#include <errno.h>
24#include <sys/types.h> // kill (2)
25#include <signal.h> // kill (2)
26#include <unistd.h> // pipe (2)
27
28#include "assa/Pipe.h"
29#include "assa/Fork.h"
30
31using namespace ASSA;
32
34Pipe ()
35 : m_fp (NULL),
36 m_child_pid (0)
37 {
38 trace_with_mask("Pipe::Pipe", PIPE);
39 /* no-op */
40}
41
43~Pipe ()
44{
45 trace_with_mask("Pipe::~Pipe", PIPE);
46 close ();
47}
48
49FILE*
51open (const string& cmd_, const string& type_)
52{
53