head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC5:1.1.1.4
	netbsd-11-0-RC4:1.1.1.4
	netbsd-11-0-RC3:1.1.1.4
	netbsd-11-0-RC2:1.1.1.4
	netbsd-11-0-RC1:1.1.1.4
	perseant-exfatfs-base-20250801:1.1.1.4
	netbsd-11:1.1.1.4.0.46
	netbsd-11-base:1.1.1.4
	netbsd-10-1-RELEASE:1.1.1.4
	perseant-exfatfs-base-20240630:1.1.1.4
	perseant-exfatfs:1.1.1.4.0.44
	perseant-exfatfs-base:1.1.1.4
	netbsd-8-3-RELEASE:1.1.1.4
	netbsd-9-4-RELEASE:1.1.1.4
	netbsd-10-0-RELEASE:1.1.1.4
	netbsd-10-0-RC6:1.1.1.4
	netbsd-10-0-RC5:1.1.1.4
	netbsd-10-0-RC4:1.1.1.4
	netbsd-10-0-RC3:1.1.1.4
	netbsd-10-0-RC2:1.1.1.4
	netbsd-10-0-RC1:1.1.1.4
	netbsd-10:1.1.1.4.0.42
	netbsd-10-base:1.1.1.4
	netbsd-9-3-RELEASE:1.1.1.4
	cjep_sun2x-base1:1.1.1.4
	cjep_sun2x:1.1.1.4.0.40
	cjep_sun2x-base:1.1.1.4
	cjep_staticlib_x-base1:1.1.1.4
	netbsd-9-2-RELEASE:1.1.1.4
	cjep_staticlib_x:1.1.1.4.0.38
	cjep_staticlib_x-base:1.1.1.4
	netbsd-9-1-RELEASE:1.1.1.4
	phil-wifi-20200421:1.1.1.4
	phil-wifi-20200411:1.1.1.4
	is-mlppp:1.1.1.4.0.36
	is-mlppp-base:1.1.1.4
	phil-wifi-20200406:1.1.1.4
	netbsd-8-2-RELEASE:1.1.1.4
	netbsd-9-0-RELEASE:1.1.1.4
	netbsd-9-0-RC2:1.1.1.4
	netbsd-9-0-RC1:1.1.1.4
	phil-wifi-20191119:1.1.1.4
	netbsd-9:1.1.1.4.0.34
	netbsd-9-base:1.1.1.4
	phil-wifi-20190609:1.1.1.4
	netbsd-8-1-RELEASE:1.1.1.4
	netbsd-8-1-RC1:1.1.1.4
	pgoyette-compat-merge-20190127:1.1.1.4
	pgoyette-compat-20190127:1.1.1.4
	pgoyette-compat-20190118:1.1.1.4
	pgoyette-compat-1226:1.1.1.4
	pgoyette-compat-1126:1.1.1.4
	pgoyette-compat-1020:1.1.1.4
	pgoyette-compat-0930:1.1.1.4
	pgoyette-compat-0906:1.1.1.4
	netbsd-7-2-RELEASE:1.1.1.4
	pgoyette-compat-0728:1.1.1.4
	netbsd-8-0-RELEASE:1.1.1.4
	phil-wifi:1.1.1.4.0.32
	phil-wifi-base:1.1.1.4
	pgoyette-compat-0625:1.1.1.4
	netbsd-8-0-RC2:1.1.1.4
	pgoyette-compat-0521:1.1.1.4
	pgoyette-compat-0502:1.1.1.4
	pgoyette-compat-0422:1.1.1.4
	netbsd-8-0-RC1:1.1.1.4
	pgoyette-compat-0415:1.1.1.4
	pgoyette-compat-0407:1.1.1.4
	pgoyette-compat-0330:1.1.1.4
	pgoyette-compat-0322:1.1.1.4
	pgoyette-compat-0315:1.1.1.4
	netbsd-7-1-2-RELEASE:1.1.1.4
	pgoyette-compat:1.1.1.4.0.30
	pgoyette-compat-base:1.1.1.4
	netbsd-7-1-1-RELEASE:1.1.1.4
	matt-nb8-mediatek:1.1.1.4.0.28
	matt-nb8-mediatek-base:1.1.1.4
	perseant-stdc-iso10646:1.1.1.4.0.26
	perseant-stdc-iso10646-base:1.1.1.4
	netbsd-8:1.1.1.4.0.24
	netbsd-8-base:1.1.1.4
	prg-localcount2-base3:1.1.1.4
	prg-localcount2-base2:1.1.1.4
	prg-localcount2-base1:1.1.1.4
	prg-localcount2:1.1.1.4.0.22
	prg-localcount2-base:1.1.1.4
	pgoyette-localcount-20170426:1.1.1.4
	bouyer-socketcan-base1:1.1.1.4
	pgoyette-localcount-20170320:1.1.1.4
	netbsd-7-1:1.1.1.4.0.20
	netbsd-7-1-RELEASE:1.1.1.4
	netbsd-7-1-RC2:1.1.1.4
	netbsd-7-nhusb-base-20170116:1.1.1.4
	bouyer-socketcan:1.1.1.4.0.18
	bouyer-socketcan-base:1.1.1.4
	pgoyette-localcount-20170107:1.1.1.4
	netbsd-7-1-RC1:1.1.1.4
	pgoyette-localcount-20161104:1.1.1.4
	netbsd-7-0-2-RELEASE:1.1.1.4
	localcount-20160914:1.1.1.4
	netbsd-7-nhusb:1.1.1.4.0.16
	netbsd-7-nhusb-base:1.1.1.4
	pgoyette-localcount-20160806:1.1.1.4
	pgoyette-localcount-20160726:1.1.1.4
	pgoyette-localcount:1.1.1.4.0.14
	pgoyette-localcount-base:1.1.1.4
	netbsd-7-0-1-RELEASE:1.1.1.4
	netbsd-7-0:1.1.1.4.0.12
	netbsd-7-0-RELEASE:1.1.1.4
	netbsd-7-0-RC3:1.1.1.4
	netbsd-7-0-RC2:1.1.1.4
	netbsd-7-0-RC1:1.1.1.4
	netbsd-6-0-6-RELEASE:1.1.1.3
	netbsd-6-1-5-RELEASE:1.1.1.3
	netbsd-7:1.1.1.4.0.10
	netbsd-7-base:1.1.1.4
	yamt-pagecache-base9:1.1.1.4
	yamt-pagecache-tag8:1.1.1.2.6.1
	netbsd-6-1-4-RELEASE:1.1.1.3
	netbsd-6-0-5-RELEASE:1.1.1.3
	tls-earlyentropy:1.1.1.4.0.8
	tls-earlyentropy-base:1.1.1.4
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.4
	riastradh-drm2-base3:1.1.1.4
	atf-0-20:1.1.1.4
	atf-0-19:1.1.1.4
	GITHUB_JMMV:1.1.1
	netbsd-6-1-3-RELEASE:1.1.1.3
	netbsd-6-0-4-RELEASE:1.1.1.3
	netbsd-6-1-2-RELEASE:1.1.1.3
	netbsd-6-0-3-RELEASE:1.1.1.3
	netbsd-6-1-1-RELEASE:1.1.1.3
	riastradh-drm2-base2:1.1.1.4
	riastradh-drm2-base1:1.1.1.4
	riastradh-drm2:1.1.1.4.0.2
	riastradh-drm2-base:1.1.1.4
	netbsd-6-1:1.1.1.3.0.10
	netbsd-6-0-2-RELEASE:1.1.1.3
	netbsd-6-1-RELEASE:1.1.1.3
	khorben-n900:1.1.1.4.0.6
	netbsd-6-1-RC4:1.1.1.3
	netbsd-6-1-RC3:1.1.1.3
	agc-symver:1.1.1.4.0.4
	agc-symver-base:1.1.1.4
	netbsd-6-1-RC2:1.1.1.3
	netbsd-6-1-RC1:1.1.1.3
	atf-0-17:1.1.1.4
	yamt-pagecache-base8:1.1.1.3
	netbsd-6-0-1-RELEASE:1.1.1.3
	yamt-pagecache-base7:1.1.1.3
	matt-nb6-plus-nbase:1.1.1.3
	yamt-pagecache-base6:1.1.1.3
	netbsd-6-0:1.1.1.3.0.8
	netbsd-6-0-RELEASE:1.1.1.3
	netbsd-6-0-RC2:1.1.1.3
	tls-maxphys:1.1.1.3.0.6
	tls-maxphys-base:1.1.1.4
	matt-nb6-plus:1.1.1.3.0.4
	matt-nb6-plus-base:1.1.1.3
	netbsd-6-0-RC1:1.1.1.3
	atf-0-16:1.1.1.3
	yamt-pagecache-base5:1.1.1.3
	yamt-pagecache-base4:1.1.1.3
	netbsd-6:1.1.1.3.0.2
	netbsd-6-base:1.1.1.3
	atf-0-15:1.1.1.3
	yamt-pagecache-base3:1.1.1.2
	yamt-pagecache-base2:1.1.1.2
	yamt-pagecache:1.1.1.2.0.6
	yamt-pagecache-base:1.1.1.2
	atf-0-14:1.1.1.2
	cherry-xenmp:1.1.1.2.0.4
	cherry-xenmp-base:1.1.1.2
	atf-0-13:1.1.1.2
	bouyer-quota2-nbase:1.1.1.2
	bouyer-quota2:1.1.1.2.0.2
	bouyer-quota2-base:1.1.1.2
	matt-mips64-premerge-20101231:1.1.1.2
	atf-0-12:1.1.1.2
	atf-0-11:1.1.1.2
	atf-0-10:1.1.1.2
	atf-0-9:1.1.1.2
	atf-0-8:1.1.1.2
	atf-0-7:1.1.1.2
	matt-premerge-20091211:1.1.1.1
	jym-xensuspend-nbase:1.1.1.1
	jym-xensuspend:1.1.1.1.0.2
	jym-xensuspend-base:1.1.1.1
	atf-0-6:1.1.1.1
	TNF:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2009.01.19.07.11.51;	author jmmv;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2009.01.19.07.11.51;	author jmmv;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2009.12.22.13.25.56;	author jmmv;	state Exp;
branches
	1.1.1.2.6.1;
next	1.1.1.3;

1.1.1.3
date	2012.01.16.22.36.43;	author jmmv;	state Exp;
branches
	1.1.1.3.6.1;
next	1.1.1.4;

1.1.1.4
date	2013.02.15.17.04.16;	author jmmv;	state Exp;
branches;
next	;

1.1.1.2.6.1
date	2012.04.17.00.03.01;	author yamt;	state Exp;
branches;
next	1.1.1.2.6.2;

1.1.1.2.6.2
date	2014.05.22.15.40.11;	author yamt;	state Exp;
branches;
next	;
commitid	TzMwNuE6CLSD5yBx;

1.1.1.3.6.1
date	2013.02.25.00.24.54;	author tls;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@//
// Automated Testing Framework (atf)
//
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#if !defined(_ATF_CXX_UTILS_HPP_)
#define _ATF_CXX_UTILS_HPP_

#include <cstddef>

namespace atf {
namespace utils {

// ------------------------------------------------------------------------
// The "auto_array" class.
// ------------------------------------------------------------------------

template< class T >
class auto_array {
    T* m_ptr;

public:
    auto_array(T* = NULL) throw();
    auto_array(auto_array< T >&) throw();
    ~auto_array(void) throw();

    T* get(void) throw();
    T* release(void) throw();
    void reset(T* = NULL) throw();

    auto_array< T >& operator=(auto_array< T >&) throw();
    T& operator[](int) throw();
};

template< class T >
auto_array< T >::auto_array(T* ptr)
    throw() :
    m_ptr(ptr)
{
}

template< class T >
auto_array< T >::auto_array(auto_array< T >& ptr)
    throw() :
    m_ptr(ptr.release())
{
}

template< class T >
auto_array< T >::~auto_array(void)
    throw()
{
    if (m_ptr != NULL)
        delete [] m_ptr;
}

template< class T >
T*
auto_array< T >::get(void)
    throw()
{
    return m_ptr;
}

template< class T >
T*
auto_array< T >::release(void)
    throw()
{
    T* ptr = m_ptr;
    m_ptr = NULL;
    return ptr;
}

template< class T >
void
auto_array< T >::reset(T* ptr)
    throw()
{
    if (m_ptr != NULL)
        delete [] m_ptr;
    m_ptr = ptr;
}

template< class T >
auto_array< T >&
auto_array< T >::operator=(auto_array< T >& ptr)
    throw()
{
    reset(ptr.release());
    return *this;
}

template< class T >
T&
auto_array< T >::operator[](int pos)
    throw()
{
    return m_ptr[pos];
}

// ------------------------------------------------------------------------
// The "noncopyable" class.
// ------------------------------------------------------------------------

class noncopyable {
    // The class cannot be empty; otherwise we get ABI-stability warnings
    // during the build, which will break it due to strict checking.
    int m_noncopyable_dummy;

    noncopyable(const noncopyable& nc);
    noncopyable& operator=(const noncopyable& nc);

protected:
    // Explicitly needed to provide some non-private functions.  Otherwise
    // we also get some warnings during the build.
    noncopyable(void) {}
    ~noncopyable(void) {}
};

} // namespace utils
} // namespace atf

#endif // !defined(_ATF_CXX_UTILS_HPP_)
@


1.1.1.1
log
@Import ATF 0.6.  Replaces the old ATF 0.5 that was in dist/atf.

Changes in this release:

* Make atf-exec be able to kill its child process after a certain period of
  time; this is controlled through the new -t option.

* Change atf-sh to use atf-exec's -t option to control the test case's
  timeouts, instead of doing it internally.  Same behavior as before, but
  noticeably faster.

* atf-exec's -g option and atf-killpg are gone due to the previous change.

* Added the atf-check(1) tool, a program that executes a given command and
  checks its exit code against a known value and allows the management of
  stdout and stderr in multiple ways.  This replaces the previous atf_check
  function in the atf-sh library and exposes this functionality to both
  atf-c and atf-c++.

* Added the ATF_REQUIRE family of macros to the C interface.  These help
  in checking for fatal test conditions.  The old ATF_CHECK macros now
  perform non-fatal checks only.  I.e. by using ATF_CHECK, the test case
  can now continue its execution and the failures will not be reported
  until the end of the whole run.

* Extended the amount of ATF_CHECK_* C macros with new ones to provide more
  features to the developer.  These also have their corresponding
  counterparts in the ATF_REQUIRE_* family.  The new macros (listing the
  suffixes only) are: _EQ (replaces _EQUAL), _EQ_MSG, _STREQ and
  _STREQ_MSG.
@
text
@@


1.1.1.2
log
@Import atf 0.7.  Changes in this release:

* Added build-time checks to atf-c and atf-c++.  A binding for atf-sh
  will come later.

* Migrated all build-time checks for header files to proper ATF tests.
  This demonstrates the use of the new feature described above.

* Added an internal API for child process management.

* Converted all plain-text distribution documents to a Docbook canonical
  version, and include pre-generated plain text and HTML copies in the
  distribution file.

* Simplified the contents of the Makefile.am by regenerating it from a
  canonical Makefile.am.m4 source.  As a side-effect, some dependency
  specifications were fixed.

* Migrated all checks from the check target to installcheck, as these
  require ATF to be installed.

* Fixed sign comparison mismatches triggered by the now-enabled
  -Wsign-compare.

* Fixed many memory and object leaks.
@
text
@d4 1
a4 1
// Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
a42 13
struct auto_array_ref {
    T* m_ptr;

    explicit auto_array_ref(T*);
};

template< class T >
auto_array_ref< T >::auto_array_ref(T* ptr) :
    m_ptr(ptr)
{
}

template< class T >
a48 1
    auto_array(auto_array_ref< T >) throw();
a51 1
    const T* get(void) const throw();
a55 2
    auto_array< T >& operator=(auto_array_ref< T >) throw();

a56 1
    operator auto_array_ref< T >(void) throw();
a73 7
auto_array< T >::auto_array(auto_array_ref< T > ref)
    throw() :
    m_ptr(ref.m_ptr)
{
}

template< class T >
a89 8
const T*
auto_array< T >::get(void)
    const throw()
{
    return m_ptr;
}

template< class T >
a118 12
auto_array< T >&
auto_array< T >::operator=(auto_array_ref< T > ref)
    throw()
{
    if (m_ptr != ref.m_ptr) {
        delete [] m_ptr;
        m_ptr = ref.m_ptr;
    }
    return *this;
}

template< class T >
a125 7
template< class T >
auto_array< T >::operator auto_array_ref< T >(void)
    throw()
{
    return auto_array_ref< T >(release());
}

@


1.1.1.2.6.1
log
@sync with head
@
text
@d4 1
a4 1
// Copyright (c) 2007 The NetBSD Foundation, Inc.
@


1.1.1.2.6.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d33 79
a111 2
extern "C" {
#include <unistd.h>
d114 17
a130 1
#include <string>
d132 18
a149 2
namespace atf {
namespace utils {
d151 8
a158 19
void cat_file(const std::string&, const std::string&);
bool compare_file(const std::string&, const std::string&);
void copy_file(const std::string&, const std::string&);
void create_file(const std::string&, const std::string&);
bool file_exists(const std::string&);
pid_t fork(void);
bool grep_file(const std::string&, const std::string&);
bool grep_string(const std::string&, const std::string&);
void redirect(const int, const std::string&);
void wait(const pid_t, const int, const std::string&, const std::string&);

template< typename Collection >
bool
grep_collection(const std::string& regexp, const Collection& collection)
{
    for (typename Collection::const_iterator iter = collection.begin();
         iter != collection.end(); ++iter) {
        if (grep_string(regexp, *iter))
            return true;
d160 9
a168 1
    return false;
d171 26
@


1.1.1.3
log
@Import atf 0.15: the major goal of this import is to reconcile any local
changes to the atf codebase with upstream code.  All local changes should
have been backported, with appropriate portability workarounds where
necessary.

This new release also includes other changes though, such as performance
improvements and bug fixes, and also a major new feature partially
implemented by pgoyette@@: the time to execute each test cases and test
program is now recorded and included in the output reports.

The import into NetBSD has been tested natively on amd64 and macppc, and
the full test suite has also been run through anita on amd64 and i386.
No regressions observed... but you never know.

From the NEWS file, the changes in this version are as follows:

Experimental version released on January 16th, 2012.

* Respect stdin in atf-check.  The previous release silenced stdin for any
  processes spawned by atf, not only test programs, which caused breakage
  in tests that pipe data through atf-check.

* Performance improvements to atf-sh.

* Enabled detection of unused parameters and variables in the code and
  fixed all warnings.

* Changed the behavior of "developer mode".  Compiler warnings are now
  enabled unconditionally regardless of whether we are in developer mode or
  not; developer mode is now only used to perform strict warning checks and
  to enable assertions.  Additionally, developer mode is now only
  automatically enabled when building from the repository, not for formal
  releases.

* Added new Autoconf M4 macros (ATF_ARG_WITH, ATF_CHECK_C and
  ATF_CHECK_CXX) to provide a consistent way of defining a --with-arg flag
  in configure scripts and detecting the presence of any of the ATF
  bindings.  Note that ATF_CHECK_SH was already introduced in 0.14, but it
  has now been modified to also honor --with-atf if instantiated.

* Added timing support to atf-run / atf-report.

* Added support for a 'require.memory' property, to specify the minimum
  amount of physical memory needed by the test case to yield valid results.

* PR bin/45690: Force an ISO-8859-1 encoding in the XML files generated by
  atf-report so that invalid data in the output of test cases does not
  mangle our report.
@
text
@d4 1
a4 1
// Copyright (c) 2007 The NetBSD Foundation, Inc.
@


1.1.1.3.6.1
log
@resync with head
@
text
@d33 79
a111 2
extern "C" {
#include <unistd.h>
d114 17
a130 1
#include <string>
d132 18
a149 2
namespace atf {
namespace utils {
d151 8
a158 19
void cat_file(const std::string&, const std::string&);
bool compare_file(const std::string&, const std::string&);
void copy_file(const std::string&, const std::string&);
void create_file(const std::string&, const std::string&);
bool file_exists(const std::string&);
pid_t fork(void);
bool grep_file(const std::string&, const std::string&);
bool grep_string(const std::string&, const std::string&);
void redirect(const int, const std::string&);
void wait(const pid_t, const int, const std::string&, const std::string&);

template< typename Collection >
bool
grep_collection(const std::string& regexp, const Collection& collection)
{
    for (typename Collection::const_iterator iter = collection.begin();
         iter != collection.end(); ++iter) {
        if (grep_string(regexp, *iter))
            return true;
d160 9
a168 1
    return false;
d171 26
@


1.1.1.4
log
@Import atf 0.17:

Experimental version released on February 14th, 2013.

* Added the atf_utils_cat_file, atf_utils_compare_file,
  atf_utils_copy_file, atf_utils_create_file, atf_utils_file_exists,
  atf_utils_fork, atf_utils_grep_file, atf_utils_grep_string,
  atf_utils_readline, atf_utils_redirect and atf_utils_wait utility
  functions to atf-c-api.  Documented the already-public
  atf_utils_free_charpp function.

* Added the cat_file, compare_file, copy_file, create_file, file_exists,
  fork, grep_collection, grep_file, grep_string, redirect and wait
  functions to the atf::utils namespace of atf-c++-api.  These are
  wrappers around the same functions added to the atf-c-api library.

* Added the ATF_CHECK_MATCH, ATF_CHECK_MATCH_MSG, ATF_REQUIRE_MATCH and
  ATF_REQUIRE_MATCH_MSG macros to atf-c to simplify the validation of a
  string against a regular expression.

* Miscellaneous fixes for manpage typos and compilation problems with
  clang.

* Added caching of the results of those configure tests that rely on
  executing a test program.  This should help crossbuild systems by
  providing a mechanism to pre-specify what the results should be.

* PR bin/45690: Make atf-report convert any non-printable characters to
  a plain-text representation (matching their corresponding hexadecimal
  entities) in XML output files.  This is to prevent the output of test
  cases from breaking xsltproc later.
@
text
@d33 79
a111 2
extern "C" {
#include <unistd.h>
d114 17
a130 1
#include <string>
d132 18
a149 2
namespace atf {
namespace utils {
d151 8
a158 19
void cat_file(const std::string&, const std::string&);
bool compare_file(const std::string&, const std::string&);
void copy_file(const std::string&, const std::string&);
void create_file(const std::string&, const std::string&);
bool file_exists(const std::string&);
pid_t fork(void);
bool grep_file(const std::string&, const std::string&);
bool grep_string(const std::string&, const std::string&);
void redirect(const int, const std::string&);
void wait(const pid_t, const int, const std::string&, const std::string&);

template< typename Collection >
bool
grep_collection(const std::string& regexp, const Collection& collection)
{
    for (typename Collection::const_iterator iter = collection.begin();
         iter != collection.end(); ++iter) {
        if (grep_string(regexp, *iter))
            return true;
d160 9
a168 1
    return false;
d171 26
@


