xapian-core  1.4.27
Functions
unixcmds.cc File Reference

C++ function versions of useful Unix commands. More...

#include <config.h>
#include "unixcmds.h"
#include <string>
#include <cerrno>
#include <cstdlib>
#include <sys/types.h>
#include "safeunistd.h"
#include "safefcntl.h"
#include "append_filename_arg.h"
#include "errno_to_string.h"
#include "filetests.h"
#include "str.h"
+ Include dependency graph for unixcmds.cc:

Go to the source code of this file.

Functions

static void checked_system (const string &cmd)
 Call system() and throw exception if it fails. More...
 
void cp_R (const std::string &src, const std::string &dest)
 Recursively copy a directory. More...
 
void rm_rf (const string &filename)
 Remove a directory and contents, just like the Unix "rm -rf" command. More...
 
void touch (const string &filename)
 Touch a file, just like the Unix "touch" command. More...
 

Detailed Description

C++ function versions of useful Unix commands.

Definition in file unixcmds.cc.

Function Documentation

◆ checked_system()

static void checked_system ( const string &  cmd)
static

Call system() and throw exception if it fails.

Definition at line 54 of file unixcmds.cc.

References Xapian::Internal::str().

Referenced by cp_R(), and rm_rf().

◆ cp_R()

void cp_R ( const std::string &  src,
const std::string &  dest 
)

Recursively copy a directory.

Recursively copy a directory, just like the Unix "cp -R" command.

Definition at line 67 of file unixcmds.cc.

References append_filename_argument(), and checked_system().

Referenced by DEFINE_TESTCASE().

◆ rm_rf()

void rm_rf ( const string &  filename)

◆ touch()

void touch ( const string &  filename)

Touch a file, just like the Unix "touch" command.

Definition at line 155 of file unixcmds.cc.

References close(), O_BINARY, and Xapian::InMemory::open().

Referenced by DEFINE_TESTCASE().