File: vmatch.cc

package info (click to toggle)
filtermail 1.06.00-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,688 kB
  • sloc: cpp: 2,487; fortran: 249; makefile: 106; ansic: 51; sh: 36
file content (36 lines) | stat: -rw-r--r-- 779 bytes parent folder | download | duplicates (2)
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
//#define XERR
#include "script.ih"

// First name are the mail headers, 2nd name is the mail input 
// (cf. Expr::script)

// overrides
bool Script::vMatch(string const &tmpStreamNames) const
{
    string cmd{ d_command.substr(0, d_command.find_first_of(" \t")) };

    error_code ec;

    if (not exists(cmd, ec))
        throw Exception{} << cmd << " DOES NOT EXIST";

    file_status stat = status(cmd, ec);
    
    if (
        (status(cmd, ec).permissions() & perms::owner_exec) 
        != perms::owner_exec
    )
        throw Exception{} << cmd << " NOT EXECUTABLE";
    
    cmd = d_command + ' ' + tmpStreamNames;

    Proc proc{ cmd, Proc::NONE, static_cast<Proc::ProcType>(d_mode) };

    proc.start();
    int ret = proc.waitForChild();

    return ret == 0;
}